summaryrefslogtreecommitdiff
path: root/Master/texmf/asymptote/three_surface.asy
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf/asymptote/three_surface.asy')
-rw-r--r--Master/texmf/asymptote/three_surface.asy22
1 files changed, 19 insertions, 3 deletions
diff --git a/Master/texmf/asymptote/three_surface.asy b/Master/texmf/asymptote/three_surface.asy
index 55060cb516d..597104ad202 100644
--- a/Master/texmf/asymptote/three_surface.asy
+++ b/Master/texmf/asymptote/three_surface.asy
@@ -681,6 +681,22 @@ struct surface {
triple[][] normals=new triple[][],
pen[][] colors=new pen[][], bool3 planar=default) {
s=new patch[];
+ if(planar == true) {// Assume all path3 elements share a common normal.
+ if(external.length != 0) {
+ triple n=normal(external[0]);
+ if(n != O) {
+ transform3 T=align(n);
+ external=transpose(T)*external;
+ T *= shift(0,0,point(external[0],0).z);
+ path[] g=sequence(new path(int i) {return path(external[i]);},
+ external.length);
+ for(patch p : surface(g).s)
+ s.push(T*p);
+ return;
+ }
+ }
+ }
+
for(int i=0; i < external.length; ++i)
construct(external[i],
internal.length == 0 ? new triple[] : internal[i],
@@ -1175,11 +1191,11 @@ void label(picture pic=currentpicture, Label L, triple position,
pic.add(new void(frame f, transform3 t, picture pic, projection P) {
// Handle relative projected 3D alignments.
Label L=L.copy();
+ triple v=t*position;
if(!align.is3D && L.align.relative && L.align.dir3 != O &&
determinant(P.t) != 0)
- L.align(L.align.dir*unit(project(L.align.dir3,P.t)));
+ L.align(L.align.dir*unit(project(v+L.align.dir3,P.t)-project(v,P.t)));
- triple v=t*position;
if(L.defaulttransform3)
L.T3=transform3(P);
if(is3D())
@@ -1218,7 +1234,7 @@ void label(picture pic=currentpicture, Label L, path3 g, align align=NoAlign,
if(L.align.default) {
align a;
a.init(-I*(position <= sqrtEpsilon ? S :
- position >= length(g)-sqrtEpsilon ? N : E),relative=true);
+ position >= length(g)-sqrtEpsilon ? N : E),relative=true);
a.dir3=dir(g,position); // Pass 3D direction via unused field.
L.align(a);
}