diff options
Diffstat (limited to 'Master/texmf/doc/asymptote/examples/animations/sphere.asy')
-rw-r--r-- | Master/texmf/doc/asymptote/examples/animations/sphere.asy | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/Master/texmf/doc/asymptote/examples/animations/sphere.asy b/Master/texmf/doc/asymptote/examples/animations/sphere.asy new file mode 100644 index 00000000000..e6bcb589add --- /dev/null +++ b/Master/texmf/doc/asymptote/examples/animations/sphere.asy @@ -0,0 +1,44 @@ +import solids; +import animation; + +currentprojection=orthographic((0,5,2)); +currentlight=(0,5,5); +settings.thick=false; + +int nbpts=200; +real step=2*pi/nbpts; +int angle=10; + +unitsize(1cm); + +triple[] P=new triple[nbpts]; +for(int i=0; i < nbpts; ++i) { + real t=-pi+i*step; + P[i]=(3sin(t)*cos(2t),3sin(t)*sin(2t),3cos(t)); +} + +transform3 t=rotate(angle,(0,0,0),(1,0.25,0.25)); +revolution r=sphere(O,3); +draw(surface(r),lightgrey); +skeleton s; +r.transverse(s,reltime(r.g,0.5)); +r.longitudinal(s); +draw(s.transverse.back,linetype("8 8",8)); +draw(s.transverse.front); + +animation A; + +for(int phi=0; phi < 360; phi += angle) { + bool[] front=new bool[nbpts]; + save(); + for(int i=0; i < nbpts; ++i) { + P[i]=t*P[i]; + front[i]=dot(P[i],currentprojection.camera) > 0; + } + draw(segment(P,front,operator ..),1mm+blue+extendcap); + draw(segment(P,!front,operator ..),grey); + A.add(); + restore(); +} + +A.movie(0,200); |