% Test raytrace.m
N = 100; % number of vertices to trace

% Random initial conditions
L=2;
% L *= rand() % Let the side length be a random number between 0 and 2.

phi0 = 2*pi*rand()
x0 = L*(rand()-1/2)
y0 = 2*(rand()-1/2)


% Try out the raytrace
[xs,ys] = raytrace(N, x0, y0, phi0, L);

% Plot
figure(1)
hold off
plot(xs,ys,'k-')
hold on
plot([x0],[y0],'yo')
plot([x0,xs(1:10)],[y0,ys(1:10)],'y-')
axis equal

% Density image
figure(2)
foo = density(xs,ys,L,0.01);
axis equal