PIPRIME.FR BLOG

Live fully to honor life

Tag Direction (3D) -- Asymptote Gallery

đź”—three-fig001

Figure three 001 Generated with Asymptote

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-fig004

Figure three 004 Generated with Asymptote

Show three/fig0040.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 3D | Three.asy
Tags : #Arrow (3D) | #Triple | #Arc (3D) | #Direction (3D) | #Plan

import three;
size(8cm, 0);
real radius=1, theta=37, phi=60;

currentprojection=perspective(4, 1, 2);

// Planes
pen bg=gray(0.9)+opacity(0.5);
draw(surface((1.2, 0, 0)--(1.2, 0, 1.2)--(0, 0, 1.2)--(0, 0, 0)--cycle), bg, bg);
draw(surface((0, 1.2, 0)--(0, 1.2, 1.2)--(0, 0, 1.2)--(0, 0, 0)--cycle), bg, bg);
draw(surface((1.2, 0, 0)--(1.2, 1.2, 0)--(0, 1.2, 0)--(0, 0, 0)--cycle), bg, bg);

real r=1.5;
draw(Label("$x$", 1), O--r*X, Arrow3(HookHead3));
draw(Label("$y$", 1), O--r*Y, Arrow3(HookHead3));
draw(Label("$z$", 1), O--r*Z, Arrow3(HookHead3));
label("$\rm O$",  (0, 0, 0), W);

triple pQ=radius*dir(theta, phi); // Point Q
// triple pQ=radius*expi(radians(theta), radians(phi)); // Point Q
draw(O--radius*dir(90, phi)^^O--pQ, dashed);
dot("$R*\mathrm{dir}\left(\theta, \phi\right)$", pQ);

// Arcs
draw("$\theta$", reverse(arc(O, 0.5*pQ, 0.5*Z)), N+0.3E, Arrow3(HookHead2));
draw("$\phi$", arc(O, 0.5*X, 0.5*(pQ.x, pQ.y, 0)), N+0.3E, Arrow3(HookHead2));

path3 p3=O--arc(O, radius, 0, phi, 90, phi)--cycle;
draw(surface(p3), blue+opacity(0.5));

0%