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 classdef Antenna
properties properties
position Vect;
amplitude = ones(1, 1000); amplitude = ones(1, 1000);
phase = zeros(1, 1000); phase = zeros(1, 1000);
integral; integral = zeros(1, 1000);
position Vect;
end end
methods methods
...@@ -15,7 +15,7 @@ classdef Antenna ...@@ -15,7 +15,7 @@ classdef Antenna
end end
dPhi = 2 * pi / length(obj.amplitude); dPhi = 2 * pi / length(obj.amplitude);
for j=1: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
end end
......
classdef BalazsAperture < Barrier classdef BalazsAperture < Aperture
properties 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 nslice = 1; %change from original
collisions = 0; collisions = [];
end end
methods methods
function obj = BalazsAperture(center, size, nslice) function obj = BalazsAperture(center, size, nslice)
...@@ -16,22 +12,11 @@ classdef BalazsAperture < Barrier ...@@ -16,22 +12,11 @@ classdef BalazsAperture < Barrier
obj.collisions = zeros(1, nslice); obj.collisions = zeros(1, nslice);
end end
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 function histogram = getCollisionHistogram(obj) %change from original
histogram = obj.collisions; histogram = obj.collisions;
end end
function post_collide(obj, col, trace) function post_collide(obj, col, trace)
if (col.collided) %change from original if (col.collided) %change from original
i = floor(obj.nslice*(col.pos.y-obj.center.y+obj.size/2)/obj.size) + 1; i = floor(obj.nslice*(col.pos.y-obj.center.y+obj.size/2)/obj.size) + 1;
...@@ -39,10 +24,6 @@ classdef BalazsAperture < Barrier ...@@ -39,10 +24,6 @@ classdef BalazsAperture < Barrier
obj.collisions(i) = obj.collisions(i) + exp(1i*phase); obj.collisions(i) = obj.collisions(i) + exp(1i*phase);
end end
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
end end
...@@ -18,6 +18,7 @@ classdef FarField ...@@ -18,6 +18,7 @@ classdef FarField
r = linspace(0, apertureSize/2, nr); r = linspace(0, apertureSize/2, nr);
c1 = (apertureSize/(2*nr))*2*pi/nfi; c1 = (apertureSize/(2*nr))*2*pi/nfi;
c2 = 1i*2*pi/wavelength; c2 = 1i*2*pi/wavelength;
for i = 1:ntheta for i = 1:ntheta
if getappdata(progressBar2,'canceling') if getappdata(progressBar2,'canceling')
break; break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment