🔗Asymptote Gallery Tagged by “Projection (3D)” #163
🔗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();
🔗graph3-fig011

Show graph3/fig0110.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 3D | Graph3.asy
Tags : #Graph (3D) | #Surface | #Level set (3D) | #Contour | #Function (implicit) | #Palette | #Projection (3D) | #Axis (3D) | #Label (3D) | #Shading (3D) | #Shading
import graph3; import palette; import contour; size(14cm,0); currentprojection=orthographic(-1,-1.5,0.75); currentlight=(-1,0,5); real a=1, b=1; real f(pair z) { return a*(6+sin(z.x/b)+sin(z.y/b));} real g(pair z){return f(z)-6a;} // The axes limits((0,0,4a),(14,14,8a)); xaxis3(Label("$x$",MidPoint),OutTicks()); yaxis3(Label("$y$",MidPoint),OutTicks(Step=2)); ticklabel relativelabel() { return new string(real x) {return (string)(x-6a);}; } zaxis3(Label("$z$",Relative(1),align=2E),Bounds(Min,Max),OutTicks(relativelabel())); // The surface surface s=surface(f,(0,0),(14,14),100,Spline); pen[] pens=mean(palette(s.map(zpart),Gradient(yellow,red))); // Draw the surface draw(s,pens); // Project the surface onto the XY plane. draw(planeproject(unitsquare3)*s,pens,nolight); // Draw contour for "datumz" real[] datumz={-1.5, -1, 0, 1, 1.5}; guide[][] pl=contour(g,(0,0),(14,14),datumz); for (int i=0; i < pl.length; ++i) for (int j=0; j < pl[i].length; ++j) draw(path3(pl[i][j])); // Draw the contours on the surface draw(lift(f,pl)); if(!is3D()) shipout(bbox(3mm,Fill(black)));
🔗graph3-fig012

Show graph3/fig0120.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 3D | Graph3.asy
Tags : #Graph (3D) | #Palette | #Surface | #Projection (3D) | #Shading (3D)
import graph3; import palette; real sinc(real x){return x != 0 ? sin(x)/x : 1;} real f(pair z){ real value = (sinc(pi*z.x)*sinc(pi*z.y))**2; return value^0.25; } currentprojection=orthographic(0,0,1); size(10cm,0); surface s=surface(f,(-5,-5),(5,5),100,Spline); s.colors(palette(s.map(zpart),Gradient((int)2^11 ... new pen[]{black,white}))); draw(planeproject(unitsquare3)*s,nolight);
🔗solids-fig001

Show solids/fig0010.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 3D | Solids.asy
Tags : #Solid | #Light (3D) | #Draw (3D) | #Surface | #Sphere | #Revolution | #Projection (3D)
import solids; import three; currentprojection=orthographic(1,2,2); size(6cm,0); material m = material( diffusepen=yellow, emissivepen=black, specularpen=orange, shininess=0.25, metallic=0.5, fresnel0=0.07 ); draw(surface(sphere(1)), m);
🔗solids-fig002

Show solids/fig0020.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 3D | Solids.asy
Tags : #Solid | #Light (3D) | #Draw (3D) | #Surface | #Sphere | #Revolution | #Projection (3D)
import solids; currentlight=light(paleyellow, specularfactor=3, (2,4,6)); size(6cm,0); draw(sphere(1,n=4*nslice), linewidth(bp), m=10); draw(surface(sphere(1,n=4*nslice)), orange);
🔗solids-fig003

Show solids/fig0030.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 3D | Solids.asy
Tags : #Solid | #Revolution | #Projection (3D) | #Draw (3D) | #Surface | #Sphere | #Wire frame | #Line type
// Author: John Bowman. size(6cm, 0); import solids; currentprojection=orthographic(0, 10, 5); nslice=4*nslice; revolution r=sphere(O, 1); draw(surface(r), lightgrey+opacity(0.75)); skeleton s; r.transverse(s, reltime(r.g, 0.6), currentprojection); r.transverse(s, reltime(r.g, 0.5), currentprojection); draw(s.transverse.back, linetype("8 8", 8)); draw(s.transverse.front); r.longitudinal(s, currentprojection); draw(s.longitudinal.front); draw(s.longitudinal.back, linetype("8 8", 8));
🔗solids-fig004

Show solids/fig0040.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 3D | Solids.asy
Tags : #Solid | #Transform (3D) | #Revolution | #Surface | #Sphere | #Projection (3D)
import solids; size(6cm,0); currentprojection=orthographic(100,150,30); real r=1; skeleton s; revolution sph=sphere(O,r); draw(surface(sph), palegray); path3 cle=rotate(90,X)*scale3(r)*unitcircle3; triple cam=unit(currentprojection.camera); real a=degrees(xypart(cam),false)-90; real b=-sgn(cam.z)*aCos(sqrt(cam.x^2+cam.y^2)/abs(cam)); cle=rotate(b,cross(Z,cam))*rotate(a,Z)*cle; draw(cle,4pt+red);
🔗solids-fig005

Show solids/fig0050.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 3D | Solids.asy
Tags : #Projection (3D) | #Solid | #Transform (3D) | #Revolution | #Surface | #Sphere | #Light (3D)
import solids; size(6cm,0); currentlight=light(diffuse=yellow, specular=blue, specularfactor=5, (5,-5,10)); // currentprojection=orthographic(100,100,30); real r=2; skeleton s; revolution sph=sphere(O,r); draw(surface(sph),red); triple cam=unit(currentprojection.camera); revolution cle=revolution(O,r*(rotate(90,Z)*cam),cam); draw(cle, 8pt+black);
🔗solids-fig006

Show solids/fig0060.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 3D | Solids.asy
Tags : #Solid | #Transform (3D) | #Sphere | #Projection (3D) | #
// Author: John Bowman import three; size(6cm,0); currentprojection=perspective(10,100,50); real a=2.5; draw(scale3(a)*unitsphere,lightyellow); draw(align(unit(currentprojection.vector()))*scale3(a)*unitcircle3,2bp+red);
🔗solids-fig008

Show solids/fig0080.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 3D | Solids.asy
Tags : #Solid | #Plane | #Shading (3D) | #Transform (3D) | #Projection (3D) | #Surface | #Palette
import solids; import palette; size(14cm,0); currentlight=light( gray(0.4), specularfactor=3, (-0.5,-0.25,0.45), (0.5,-0.5,0.5),(0.5,0.5,0.75) ); nslice=4*nslice; surface s=surface(sphere(O,1)); draw(s,lightgrey); path3 pl=plane((1,0,0),(0,1,0),(0,0,-1)); surface pls=shift(3,3,-1e-3)*scale(-6,-6,1)*surface(pl); draw(pls,0.7*red); real dist(triple z){return abs(z-Z);} surface shade; for (int i=0; i < currentlight.position.length; ++i) { shade=planeproject(pl,currentlight.position[i])*s; draw(shade,mean(palette((shade.map(dist)), Gradient(black,gray(0.6)))), nolight); }
🔗solids-fig013

Show solids/fig0130.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 3D | Solids.asy
Tags : #Solid | #Label (3D) | #Transform (3D) | #Projection (3D) | #Revolution
import solids; size(8cm,0); currentprojection=orthographic((2, 1, 2)); revolution r=cylinder((0, 0, 0), 1, -10, X); draw(r); draw("$x$",O--X,Arrow3); draw("$y$",O--Y,Arrow3); draw("$z$",O--Z,Arrow3); label(XY()*(scale(2.5)*"This is not a cylinder"), (-5,0,1), align=Z);
🔗three-fig006

Show three/fig0060.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 3D | Three.asy
Tags : #Label (3D) | #Projection (3D) | #Plan
settings.render=0; import three; size(4cm,0); currentprojection=perspective((45,45,30)); path3 YZ=plane((0,4,0),(0,0,4)); draw("$x$",project(O--X),Arrow); draw("$y$",project(O--Y),Arrow); draw("$z$",project(O--Z),Arrow); draw(YZ); label(scale(5)*project("A",Y,Z,(0,1,1)));
🔗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);
🔗three-fig010

Show three/fig0100.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 3D | Three.asy
Tags : #Plane | #Label (3D) | #Texpath | #Transform (3D) | #Projection (3D) | #Bsp
size(12cm,0); import bsp; currentprojection=orthographic(1,1.5,1); path3 xy=plane((1,0,0),(0,1,0),(0,0,0)); path3 xz=rotate(90,X)*xy; path3 yz=rotate(-90,Y)*xy; face[] f; filldraw(f.push(xy),project(xy),grey); filldraw(f.push(xz),project(xz),grey); filldraw(f.push(yz),project(yz),grey); add(f); draw(Label("$x$",EndPoint), O--(1,0,0), Arrow3); draw(Label("$y$",EndPoint), O--(0,1,0), Arrow3); draw(Label("$z$",EndPoint), O--(0,0,1), Arrow3); dot(O); path[] ph=texpath("$\displaystyle\int_{-\infty}^{+\infty}e^{-\alpha x^2}\,dx= \sqrt{\frac{\pi}{\alpha}}$"); ph =shift((0.5,0.5))*rotate(-45)*scale(1/abs(min(ph)-max(ph)))*ph; filldraw(project(path3(ph,XYplane)),0.8*yellow); filldraw(project(path3(ph,ZXplane)),0.8*yellow); filldraw(project(path3(ph,YZplane)),0.8*yellow);
🔗three-fig011

Show three/fig0110.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 3D | Three.asy
Tags : #Plane | #Label (3D) | #Texpath | #Transform (3D) | #Projection (3D)
import three; size(10cm,0); currentprojection=orthographic(1,1.5,1); path3 xy=XY*unitsquare3, xz=ZX*unitsquare3, yz=YZ*unitsquare3; draw(xy^^xz^^yz, grey); path3 p3xy=path3(texpath("$\pi$")[0],XYplane); p3xy=shift((0.5,0.5,0))*scale3(1/abs(min(p3xy)-max(p3xy)))*p3xy; surface s=surface(p3xy,planar=true); draw(s, surfacepen=blue, meshpen=orange+3pt); transform3 Txz=planeproject(xz,(0,-1,1)); draw(Txz*s, red); transform3 Tyz=planeproject(yz,(-1,0,1)); draw(Tyz*s, green); path3 p3xz=Txz*p3xy; path3 p3yz=Tyz*p3xy; int lg=length(p3xy); triple p; for(int i=0;i<=lg;++i) { p=point(p3xy,i); draw(p--point(p3xz,i), yellow); draw(p--point(p3yz,i), orange); }