| 1 |
% intersectorus.mp |
| 2 |
% L. Nobre G. |
| 3 |
% 2014 |
| 4 |
|
| 5 |
input featpost3Dplus2D; |
| 6 |
|
| 7 |
f := (1,-5,2); |
| 8 |
|
| 9 |
beginfig(1); |
| 10 |
numeric ray, i, Num, zcoord; |
| 11 |
color startpoi, lindir, outpoi, auxpoi; |
| 12 |
ray = 0.4; |
| 13 |
zcoord = 0.5*ray; |
| 14 |
startpoi = (-1-0.5*ray,-1,zcoord); |
| 15 |
lindir = (0,3,-2.5); |
| 16 |
Num = 50; |
| 17 |
smoothtorus( black, blue, 1, ray ); |
| 18 |
for i=0 upto Num: |
| 19 |
auxpoi := startpoi+2*(1+0.5*ray)*red*i/Num; |
| 20 |
outpoi := intersectorus( black, blue, 1, ray, auxpoi, lindir ); |
| 21 |
if pointinsidetorus( auxpoi, black, blue, 1, ray ): |
| 22 |
draw rp(auxpoi)--rp(outpoi) withpen pencircle scaled 2pt withcolor red; |
| 23 |
else: |
| 24 |
draw rp(auxpoi)--rp(outpoi) withpen pencircle scaled 2pt; |
| 25 |
fi; |
| 26 |
endfor; |
| 27 |
draw rp(startpoi)--rp(auxpoi); |
| 28 |
endfig; |
| 29 |
|
| 30 |
end. |