These are things I try:
settings.outformat="pdf";
settings.prc=false;
settings.render=0;
import three;
unitsize(1cm);
size(8cm,0);
currentprojection=orthographic(2,1,0.8);
triple v1=(4,0,0),
v2=(0,6,0),
p0=(-2,-3,0);
path3 pl=plane(v1,v2,p0);
transform3 proj=planeproject(pl);
triple pA=(1,2,4),
pB=projpA,
pC=p0+.2v1+.2v2,
vnP=unit(cross(v1,v2)),
pD=rotate(90,pC,pC+vnP)pB;
draw(surface(pl),orange);
draw(Label("$\vec{v_1}$"),p0--p0+v1,1bp+blue,Arrow3(size=8));
draw(Label("$\vec{v_2}$"),p0--p0+v2,N,1bp+blue,Arrow3(size=8));
label(project("abc",v1,v2,p0+(.5,.5,0)));
draw(surface(pA--pB--pC--cycle),opacity(.5)+gray,1bp+.8blue);
label(project("abc",v1,v2,p0+(.5,.5,0)));
dot("$A$",pA); dot("$B$",pB); dot("$C$",pC,dir(pC-pB));
triple pBpC=pC-pB,pBpA=pA-pB;
label(project("abc",pBpC,pBpA,pC+(.5,.5,0)));
dot("$p_0$",p0,NW);
shipout(bbox(2mm,Fill(white)));
All text onto plane ABC.
How to place and rotate text onto a plane in the line direction in the following case?
Additional:
// run asy -f pdf <name>.asy
settings.outformat="pdf";
settings.prc=false;
settings.render=0;
import three;
unitsize(1cm);
defaultpen(fontsize(12pt));
defaultpen(linewidth(1bp));
size(10cm,0);
currentprojection=orthographic(1.5,0.5,0.8);
triple v1=(4,0,0),v2=(0,6,0),p0=(-2,-3,0);
path3 pl=plane(v1,v2,p0);
transform3 proj=planeproject(pl);
triple pA=(1,2,4), pB=projpA, pC=p0+.2v1+.2v2,
vnP=unit(cross(v1,v2)),pD=rotate(90,pC,pC+vnP)pB;
draw(surface(pl),orange+opacity(.2));
draw(surface(pA--pB--pC--cycle),opacity(.5)+gray,1bp+.8blue);
draw(Label("$\vec{v_1}$"),p0--p0+v1,1bp+blue,Arrow3(size=8));
draw(Label("$\vec{v_2}$"),p0--p0+v2,N,1bp+blue,Arrow3(size=8));
path3 pll=plane(pB-pC,pB-pA,pC);
dot("$A$",pA); dot("$B$",pB); dot("$C$",pC,dir(pC-pB));
// draw a dimension arrow from A to B to d mm above the segment with the text (gg dich)
// https://melusine.eu.org/syracuse/asymptote/comin/geoespace.asy
void cote(triple A1,triple B1, string text, real d,bool line=true,
real pos=.5, real a=1, bool trait=false,pen sty=black, pen joinpen=dotted,
align alignLabel=RightSide ){
pair M,N;
pair A=project(A1);
pair B=project(B1);
M=A+d/10dir(degrees(B-A)+90);
N=B+d/10dir(degrees(B-A)+90);
if(line==false)
label(Label(text,Rotate(dir(degrees(a(N-M)))),position=Relative(pos),align=alignLabel),N--M);
else {
label(Label(text,Rotate(dir(degrees(a(N-M)))),position=Relative(pos),align=alignLabel),N--M);
draw(N--M,Arrows(size=5),p=sty);}
if(trait==true){ draw(A--M^^B--N,joinpen); }
}
cote(pC,pA,"distance $AC$",-4,line=false);
cote(pC,pB,"distance $BC$",-5,sty=dashed);
cote(pA,pB,"distance $AB$",-2,a=-1,alignLabel=LeftSide);
// macros3D.asy
void cote3D(picture pic=currentpicture,Label L="", triple A, triple B,
real d=5mm, triple v, bool cc=true,pen p=currentpen, pen joinpen=dotted,pen textLabel=currentpen,
arrowbar3 arrow=Arrows3(size=5))
{
transform3 T=shift(dunit(v));
triple A=A, B=B;
pic.add(new void(picture f, transform3 t) {
picture opic;
path3 dist;
triple Ap=tA, Bp=tB;
triple a=TAp, b=T*Bp;
if (cc) {dist=a--b;}
else {dist=b--a;}
draw(opic,Label(L,textLabel),dist,p,arrow);
draw(opic,a--Ap^^b--Bp,joinpen);
add(f,opic);
}, true);
}
cote3D("distance $AC$",pA,pB,d=-5mm,cc=false,textLabel=yellow,pC-pB);
shipout(bbox(2mm,Fill(white)));
A problem is discovered, how to fix my code?




currentprojection=orthographic(1.5,3.1,0.5);. – Jan 23 '20 at 16:15