| 1 |
% helix.mp |
| 2 |
% L. Nobre G. |
| 3 |
% 2012 |
| 4 |
|
| 5 |
prologues := 1; |
| 6 |
|
| 7 |
beginfig(1); |
| 8 |
numeric u, w, i, r, s, lim; |
| 9 |
u = 2in; |
| 10 |
w = 150; |
| 11 |
r = 0.5u; |
| 12 |
s = 1/20; |
| 13 |
lim = 4; |
| 14 |
for i=0 step s until lim: |
| 15 |
draw fullcircle scaled 2r shifted (u*(i,sind(i*w))); |
| 16 |
endfor; |
| 17 |
%draw origin--(u*(90/w,1)); |
| 18 |
pair d, p; |
| 19 |
path slope, decli; |
| 20 |
d = (-90/w,3.14159/2); |
| 21 |
p = unitvector((-ypart d,xpart d)); |
| 22 |
slope = ((-u*d)--(u*d)) shifted (-r*p); |
| 23 |
decli = reverse slope shifted (2*r*p); |
| 24 |
draw (slope--decli--cycle) shifted (u*180/w,0); |
| 25 |
endfig; |
| 26 |
|
| 27 |
end. |