% Run raytrace.m with a large number of vertices to get an accurate density map.
N = 1e6; % number of vertices to trace

% Random initial conditions
L = 1 %L = 2*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)

t0 = cputime;
% Try out the raytrace
[xs,ys] = raytrace(N, x0, y0, phi0, L);
t1 = cputime;
time_to_raytrace = t1-t0

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

% Save for future reference
clear t0  %Don't want this saved!
save("-binary","raytrace_longrun_data_N=1e6c.octavebinary")