| 1 |
% solardish.mp |
| 2 |
% L. Nobre G. |
| 3 |
% 2013 |
| 4 |
|
| 5 |
prologues := 1; |
| 6 |
|
| 7 |
vardef reflectrayr(expr s,a,p,l)= |
| 8 |
save tI,tn,ia,I,J; |
| 9 |
pair I,J; |
| 10 |
tI=xpart(p intersectiontimes ((s+1mm*dir(a))--(s+30cm*dir(a)))); |
| 11 |
if tI>0: |
| 12 |
I=point tI of p; |
| 13 |
draw s--I; |
| 14 |
tn=angle(direction tI of p)+90; |
| 15 |
ia:=tn-angle(s-I); |
| 16 |
reflectrayr(I,tn+ia,p,l); |
| 17 |
else: |
| 18 |
J=s+dir(a)*l; |
| 19 |
drawarrow s--J; |
| 20 |
fi; |
| 21 |
enddef; |
| 22 |
|
| 23 |
beginfig(1); % parabolic dish |
| 24 |
numeric u, i, num, calx, incidang; |
| 25 |
pair sunpoi; |
| 26 |
u = 8cm; |
| 27 |
num = 12; |
| 28 |
incidang = -60; |
| 29 |
path p; |
| 30 |
p=(-2u,u) for i=1 upto 2num: |
| 31 |
hide( calx:=-2+2*i/num; ) |
| 32 |
..(calx*u,u*(calx**2)/4) |
| 33 |
endfor; |
| 34 |
for i=1 upto 2num-1: |
| 35 |
sunpoi := ((-2+2*i/num,1)*u)-u*dir(incidang); |
| 36 |
reflectrayr(sunpoi,incidang,p,14cm); |
| 37 |
endfor; |
| 38 |
draw p withcolor red; |
| 39 |
endfig; |
| 40 |
|
| 41 |
beginfig(2); % circle evolute dish |
| 42 |
numeric u, i, num, calc, incidang, panray; |
| 43 |
pair sunpoi, crosa, crosb; |
| 44 |
u = 8cm; % this value is related with "14cm" inside reflectray |
| 45 |
num = 12; |
| 46 |
incidang = -60; |
| 47 |
panray = 2cm; |
| 48 |
path p, q, w; |
| 49 |
w = fullcircle scaled 2panray shifted (0,u-panray); |
| 50 |
p=(0,u-2panray) for i=1 upto num: |
| 51 |
hide( |
| 52 |
calc:=(i/num)*panray*3.14159; |
| 53 |
sunpoi := (0,u-panray)+dir(i*180/num-90)*panray-calc*dir(i*180/num); |
| 54 |
) |
| 55 |
..sunpoi |
| 56 |
endfor; |
| 57 |
q = reverse (p xscaled -1) & p; |
| 58 |
sunpoi := (xpart point 2 of q,u)-u*dir(incidang); |
| 59 |
crosa = sunpoi+whatever*dir(incidang); |
| 60 |
crosa = (0,u-panray)-whatever*dir(incidang+90); |
| 61 |
crosb = ((0,u-panray)--crosa) intersectionpoint w; |
| 62 |
for i=0 upto num: |
| 63 |
sunpoi := (i/num)[crosa,crosb]-u*dir(incidang); |
| 64 |
reflectrayr(sunpoi,incidang,q,5cm); |
| 65 |
endfor; |
| 66 |
pair crosa; |
| 67 |
sunpoi := (xpart point ((length q)-2) of q,u)-u*dir(incidang); |
| 68 |
crosa = sunpoi+whatever*dir(incidang); |
| 69 |
crosa = (0,u-panray)-whatever*dir(incidang+90); |
| 70 |
crosb := ((0,u-panray)--crosa) intersectionpoint w; |
| 71 |
for i=0 upto num: |
| 72 |
sunpoi := (i/num)[crosa,crosb]-u*dir(incidang); |
| 73 |
reflectrayr(sunpoi,incidang,q,5cm); |
| 74 |
endfor; |
| 75 |
draw q withcolor red; |
| 76 |
fill w withcolor 0.5white; |
| 77 |
endfig; |
| 78 |
|
| 79 |
beginfig(3); % spheric dish |
| 80 |
numeric u, i, num, incidang; |
| 81 |
pair sunpoi; |
| 82 |
u = 8cm; |
| 83 |
num = 12; |
| 84 |
incidang = -60; |
| 85 |
path p; |
| 86 |
p = halfcircle scaled 4u rotated 180 shifted (0,u); |
| 87 |
for i=1 upto 2num-1: |
| 88 |
sunpoi := ((-2+2*i/num,1)*u)-u*dir(incidang); |
| 89 |
reflectrayr(sunpoi,incidang,p,14cm); |
| 90 |
endfor; |
| 91 |
draw p withcolor red; |
| 92 |
endfig; |
| 93 |
|
| 94 |
beginfig(4); % elliptic dish |
| 95 |
numeric u, i, num, cal, incidang; |
| 96 |
pair sunpoi; |
| 97 |
u = 8cm; |
| 98 |
num = 12; |
| 99 |
incidang = -55; |
| 100 |
path p; |
| 101 |
p=(-2u,u) for i=1 upto 2num: |
| 102 |
hide( cal:=90*i/num; ) |
| 103 |
..(-2*cosd(cal)*u,u-u*sind(cal)) |
| 104 |
endfor; |
| 105 |
for i=1 upto 2num-1: |
| 106 |
sunpoi := ((-2+2*i/num,1)*u)-u*dir(incidang); |
| 107 |
reflectrayr(sunpoi,incidang,p,14cm); |
| 108 |
endfor; |
| 109 |
draw p withcolor red; |
| 110 |
endfig; |
| 111 |
|
| 112 |
end. |