PIPRIME.FR BLOG

Live fully to honor life

Tag Triple -- Asymptote Gallery

đź”—graph3-fig007

Figure graph3 007 Generated with Asymptote

Show graph3/fig0070.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 3D | Graph3.asy
Tags : #Graph (3D) | #Axis (3D) | #Triple

import graph3;

size(8cm,0);
currentprojection=orthographic(1,1,0.5);
limits((-2,-2,0),(0,2,2));

xaxis3(Label("$x$",align=Z),
       Bounds(Min,Min),
       OutTicks(endlabel=false,Step=1,step=0.5));

yaxis3("$y$", Bounds(),
       OutTicks(pTick=0.8*red, ptick=lightgrey));

zaxis3("$z$", Bounds(),
       OutTicks, p=red, arrow=Arrow3);

dot(Label("",align=Z), (-1,0,0), red);

đź”—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-fig002

Figure three 002 Generated with Asymptote

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

Figure three 003 Generated with Asymptote

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-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));

đź”—three-fig009

Figure three 009 Generated with Asymptote

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);

0%