diff options
Diffstat (limited to 'Master/texmf/asymptote/graph3.asy')
-rw-r--r-- | Master/texmf/asymptote/graph3.asy | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/Master/texmf/asymptote/graph3.asy b/Master/texmf/asymptote/graph3.asy index 1357f3e7c87..32f66851e75 100644 --- a/Master/texmf/asymptote/graph3.asy +++ b/Master/texmf/asymptote/graph3.asy @@ -126,7 +126,7 @@ void labelaxis(picture pic, transform3 T, Label L, path3 g, locate1.dir(T,g,locate,t); triple pathdir=locate1.pathdir; - triple perp=cross(pathdir,P.vector()); + triple perp=cross(pathdir,P.normal); if(align == O) align=unit(sgn(dot(sign*locate1.dir,perp))*perp); path[] g=project(box(T*m,T*M),P); @@ -149,9 +149,11 @@ void labelaxis(picture pic, transform3 T, Label L, path3 g, },exact=false); path3[] G=path3(texpath(L)); - G=L.align.is3D ? align(G,O,align,L.p) : L.T3*G; - triple v=point(g,relative(L,g)); - pic.addBox(v,v,min(G),max(G)); + if(G.length > 0) { + G=L.align.is3D ? align(G,O,align,L.p) : L.T3*G; + triple v=point(g,relative(L,g)); + pic.addBox(v,v,min(G),max(G)); + } } // Tick construction routine for a user-specified array of tick values. @@ -509,7 +511,7 @@ real ztrans(transform3 t, real z) private triple defaultdir(triple X, triple Y, triple Z, bool opposite=false, projection P) { - triple u=cross(P.vector(),Z); + triple u=cross(P.normal,Z); return abs(dot(u,X)) > abs(dot(u,Y)) ? -X : (opposite ? Y : -Y); } @@ -964,7 +966,7 @@ void xaxis3(picture pic=currentpicture, Label L="", axis axis=YZZero, bool back=false; if(axis.type == Both) { - triple v=currentprojection.vector(); + triple v=currentprojection.normal; back=dot((0,pic.userMax.y-pic.userMin.y,0),v)*sgn(v.z) > 0; } @@ -1039,7 +1041,7 @@ void yaxis3(picture pic=currentpicture, Label L="", axis axis=XZZero, bool back=false; if(axis.type == Both) { - triple v=currentprojection.vector(); + triple v=currentprojection.normal; back=dot((pic.userMax.x-pic.userMin.x,0,0),v)*sgn(v.z) > 0; } @@ -1842,10 +1844,11 @@ path3 Arc(triple c, triple v1, triple v2, triple normal=O, bool direction=CCW, real phi1=radians(longitude(v1,warn=false)); real phi2=radians(longitude(v2,warn=false)); - if(phi1 >= phi2 && direction) phi1 -= 2pi; - if(phi2 >= phi1 && !direction) phi2 -= 2pi; + if(direction) { + if(phi1 >= phi2) phi1 -= 2pi; + } else if(phi2 >= phi1) phi2 -= 2pi; - real piby2=pi/2; + static real piby2=pi/2; return shift(c)*T*polargraph(new real(real theta, real phi) {return r;}, new real(real t) {return piby2;}, new real(real t) {return interp(phi1,phi2,t);}, @@ -1869,5 +1872,10 @@ path3 Arc(triple c, real r, real theta1, real phi1, real theta2, real phi2, // True circle path3 Circle(triple c, real r, triple normal=Z, int n=nCircle) { - return Arc(c,r,90,0,90,360,normal,n)&cycle; + static real piby2=pi/2; + return shift(c)*align(unit(normal))* + polargraph(new real(real theta, real phi) {return r;}, + new real(real t) {return piby2;}, + new real(real t) {return interp(0,2pi,t);},n,operator ..); + } |