🔗Asymptote Gallery Tagged by “Path3” #174
đź”—animations-fig007
Show animations/fig0080.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Animation
Tags : #Graph (3D) | #Function (graphing) | #Animation | #Sphere | #Surface | #Path3 | #Segment
size(16cm); import graph3; import animation; import solids; settings.render=0; animation A; int nbpts=500; real q=2/5; real pas=5*2*pi/nbpts; int angle=3; real R=3; real x(real t){return R*cos(q*t)*cos(t);} real y(real t){return R*cos(q*t)*sin(t);} real z(real t){return R*sin(q*t);} triple[] P; real t=-pi; for (int i=0; i<nbpts; ++i) { t+=pas; P.push((x(t),y(t),z(t))); } currentprojection=orthographic((0,5,2)); currentlight=(3,3,5); pen p=rgb(0.1,0.1,0.58); transform3 t=rotate(angle,(0,0,0),(1,0.25,0.25)); filldraw(box((-R-0.5,-R-0.5),(R+0.5,R+0.5)), p, 3mm+black+miterjoin); revolution r=sphere(O,R); draw(surface(r),p); for (int phi=0; phi<360; phi+=angle) { bool[] back,front; save(); for (int i=0; i<nbpts; ++i) { P[i]=t*P[i]; bool test=dot(P[i],currentprojection.camera) > 0; front.push(test); } draw(segment(P,front,operator ..),linewidth(1mm)); draw(segment(P,!front,operator ..),grey); A.add(); restore(); } A.movie();
đź”—animations-fig008
Show animations/fig0090.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Animation
Tags : #Graph (3D) | #Function (graphing) | #Animation | #Sphere | #Surface | #Path3 | #Segment | #Projection (3D) | #Plane
size(16cm); import graph3; import animation; import solids; currentlight.background=black; settings.render=0; animation A; A.global=false; int nbpts=500; real q=2/5; real pas=5*2*pi/nbpts; int angle=4; real R=0.5; pen p=rgb(0.1,0.1,0.58); triple center=(1,1,1); transform3 T=rotate(angle,center,center+X+0.25*Y+0.3*Z); real x(real t){return center.x+R*cos(q*t)*cos(t);} real y(real t){return center.y+R*cos(q*t)*sin(t);} real z(real t){return center.z+R*sin(q*t);} currentprojection=orthographic(1,1,1); currentlight=(0,center.y-0.5,2*(center.z+R)); triple U=(center.x+1.1*R,0,0), V=(0,center.y+1.1*R,0); path3 xy=plane(U,V,(0,0,0)); path3 xz=rotate(90,X)*xy; path3 yz=rotate(-90,Y)*xy; triple[] P; path3 curve; real t=-pi; for (int i=0; i < nbpts; ++i) { t+=pas; triple M=(x(t),y(t),z(t)); P.push(M); curve = curve..M; } curve=curve..cycle; draw(surface(xy), grey); draw(surface(xz), grey); draw(surface(yz), grey); triple xyc=(center.x,center.y,0); path3 cle=shift(xyc)*scale3(R)*unitcircle3; surface scle=surface(cle); draw(scle, black); draw(rotate(90,X)*scle, black); draw(rotate(-90,Y)*scle, black); draw(surface(sphere(center,R)), p); triple vcam=1e5*currentprojection.camera-center; for (int phi=0; phi<360; phi+=angle) { bool[] back,front; save(); for (int i=0; i<nbpts; ++i) { P[i]=T*P[i]; bool test=dot(P[i]-center,vcam) > 0; front.push(test); } curve=T*curve; draw(segment(P,front,operator ..), paleyellow); draw(segment(P,!front,operator ..),0.5*(paleyellow+p)); draw((planeproject(xy)*curve)^^ (planeproject(xz)*curve)^^ (planeproject(yz)*curve), paleyellow); A.add(); restore(); } A.movie();
đź”—animations-fig014
Show animations/fig0150.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Animation
Tags : #Animation | #L-System | #Path3
import Lsystem; import animate; settings.tex="pdflatex"; settings.outformat="pdf"; animation A; size(10cm,0); string[][] rules={{"X","^<XF^<XFX-F^>>XFX&F+>>XFX-F>X->"}}; Lsystem3 HilbertCurve3D=Lsystem3("X", rules, La=90, Lai=0); HilbertCurve3D.iterate(3); path3[] g=HilbertCurve3D.paths3(); triple M=(max(g)+min(g))/2; currentprojection=currentprojection=orthographic((10,10,6)); for (int angle=0; angle < 360; angle += 2) { save(); draw(rotate(angle,M,M+Z)*g[0], linewidth(bp)+0.9*yellow); A.add(); restore(); } A.movie(BBox(3mm, Fill(black)));
đź”—three-fig001

Show three/fig0010.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 3D | Three.asy
Tags : #Direction (3D) | #Patch | #Path3 | #Surface | #Triple
import three; size(12cm); currentprojection=orthographic(1,1,1.5); currentlight=(1,0,1); triple P00=-X-Y+0.5*Z, P03=-X+Y, P33=X+Y, P30=X-Y; triple[][] P={ {P00,P00+(-0.5,0.5,-1),P03+(0,-0.5,1),P03}, {P00+(0.5,-0.5,-1),(-0.5,-0.5,0.5),(-0.5,0.5,-1.5),P03+(0.5,0,1)}, {P30+(-0.5,0,1),(0.5,-0.5,-1.5),(0.5,0.5,1),P33+(-0.5,0,1)}, {P30,P30+(0,0.5,1),P33+(0,-0.5,1),P33} }; surface s=surface(patch(P)); draw(s,15,15,yellow,meshpen=grey); draw(sequence(new path3(int i){ return s.s[i].external();},s.s.length), bp+red); dot("P[0][0]",P[0][0], align=N, black); dot("P[0][3]",P[0][3], black); dot("P[3][3]",P[3][3], align=S, black); dot("P[3][0]",P[3][0], align=W, black); draw(Label("P[0][1]",align=SW,EndPoint),P[0][0]--P[0][1], Arrow3); draw(Label("P[1][0]",align=SE,EndPoint),P[0][0]--P[1][0], Arrow3); draw(Label("P[0][2]",align=E,EndPoint),P[0][3]--P[0][2], Arrow3); draw(Label("P[1][3]",EndPoint),P[0][3]--P[1][3], Arrow3); draw(Label("P[2][3]",EndPoint),P[3][3]--P[2][3], Arrow3); draw(Label("P[3][2]",EndPoint),P[3][3]--P[3][2], Arrow3); draw(Label("P[3][1]",EndPoint),P[3][0]--P[3][1], Arrow3); draw(Label("P[2][0]", align=W,EndPoint),P[3][0]--P[2][0], Arrow3); dot("P[1][1]",P[1][1], align=S); dot("P[1][2]",P[1][2], align=E); dot("P[2][2]",P[2][2], align=N); dot("P[2][1]",P[2][1], align=W); for (int i=0; i < s.s.length; ++i) dot(s.s[i].internal(), bp+red); if(!is3D()) shipout(bbox(Fill(lightgrey)));
đź”—three-fig002

Show three/fig0020.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 3D | Three.asy
Tags : #Shading (3D) | #Palette | #Patch | #Path3 | #Surface | #Triple
import three; import palette; size(12cm); currentprojection=orthographic(1,1,1.5); currentlight=(1,0,1); triple P00=-X-Y+0.5*Z, P03=-X+Y, P33=X+Y, P30=X-Y; triple[][] P={ {P00,P00+(-0.5,0.5,-1),P03+(0,-0.5,1),P03}, {P00+(0.5,-0.5,-1),(-0.5,-0.5,0.5),(-0.5,0.5,-1.5),P03+(0.5,0,1)}, {P30+(-0.5,0,1),(0.5,-0.5,-1.5),(0.5,0.5,1),P33+(-0.5,0,1)}, {P30,P30+(0,0.5,1),P33+(0,-0.5,1),P33} }; surface s=surface(patch(P)); s.colors(palette(s.map(zpart),Gradient(yellow,red))); // s.colors(palette(s.map(zpart),Rainbow())); draw(s); draw(sequence(new path3(int i){ return s.s[i].external();},s.s.length), bp+orange); if(!is3D()) shipout(bbox(Fill(lightgrey)));
đź”—three-fig003

Show three/fig0030.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 3D | Three.asy
Tags : #Shading (3D) | #Palette | #Patch | #Path3 | #Surface | #Triple
import three; size(10cm); currentlight=(0,0,1); surface sf=surface(patch(P=new triple[][] { {(0,0,0),(1,0,0),(1,0,0),(2,0,0)}, {(0,1,0),(1,0,1),(1,0,1),(2,1,0)}, {(0,1,0),(1,0,-1),(1,0,-1),(2,1,0)}, {(0,2,0),(1,2,0),(1,2,0),(2,2,0)} })); draw(sf,surfacepen=yellow); draw(sf.s[0].vequals(0.5),squarecap+2bp+blue,currentlight); draw(sf.s[0].uequals(0.5),squarecap+2bp+red,currentlight);
đź”—three-fig009

Show three/fig0090.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 3D | Three.asy
Tags : #Plan | #Transform (3D) | #Projection (3D) | #Fill/Unfill | #Path3 | #Triple
size(10cm,0); import three; currentprojection=obliqueX; triple v1=(4,0,0), v2=(0,6,0), p0=(-2,-3,0); path3 pl1=plane(v1,v2,p0); path ph=transform(v1,v2,p0,currentprojection)*((0,-2){W}..(0,2){W}..cycle); filldraw(project(pl1)^^ph,evenodd+lightgrey);