Skip to content
Snippets Groups Projects
Commit 7821964f authored by lmaresz's avatar lmaresz
Browse files

BalazsAperture inherited from Aperture, minor fixes

parent 3bad8d02
No related branches found
No related tags found
No related merge requests found
classdef Antenna
properties
position Vect;
amplitude = ones(1, 1000);
phase = zeros(1, 1000);
integral;
position Vect;
integral = zeros(1, 1000);
end
methods
......@@ -15,7 +15,7 @@ classdef Antenna
end
dPhi = 2 * pi / length(obj.amplitude);
for j=1:length(obj.amplitude)
obj.integral(j) = sum(amplitude(1:j)*dPhi);
obj.integral(j) = sum(obj.amplitude(1:j)*dPhi);
end
end
......
classdef BalazsAperture < Barrier
classdef BalazsAperture < Aperture
properties
center Vect = Vect; % center position
size double = 0; % full size of reflector (end to end)
color = [0.5 0.5 0.5];
width = 2;
nslice = 1; %change from original
collisions = 0;
collisions = [];
end
methods
function obj = BalazsAperture(center, size, nslice)
......@@ -16,22 +12,11 @@ classdef BalazsAperture < Barrier
obj.collisions = zeros(1, nslice);
end
end
function col = collide(obj, ray) % override this function with custom collision
col = Collision;
col.stop = true;
k = (obj.center.x - ray.start.x)/ray.dir.x;
col.pos = ray.start + k*ray.dir;
col.reflDir = Vect(-ray.dir.x, ray.dir.y);
if abs(col.pos.y - obj.center.y) < obj.size/2 && k*ray.dir.mag > 1e-6
col.collided = true;
else
col.collided = false;
end
end
function histogram = getCollisionHistogram(obj) %change from original
histogram = obj.collisions;
end
function post_collide(obj, col, trace)
if (col.collided) %change from original
i = floor(obj.nslice*(col.pos.y-obj.center.y+obj.size/2)/obj.size) + 1;
......@@ -39,10 +24,6 @@ classdef BalazsAperture < Barrier
obj.collisions(i) = obj.collisions(i) + exp(1i*phase);
end
end
function plot_self(obj)
plot([obj.center.x obj.center.x],...
[obj.center.y - obj.size/2, obj.center.y + obj.size/2],...
'LineWidth', obj.width, 'Color', obj.color);
end
end
end
......@@ -18,6 +18,7 @@ classdef FarField
r = linspace(0, apertureSize/2, nr);
c1 = (apertureSize/(2*nr))*2*pi/nfi;
c2 = 1i*2*pi/wavelength;
for i = 1:ntheta
if getappdata(progressBar2,'canceling')
break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment