summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/asymptote/three_surface.asy
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/asymptote/three_surface.asy')
-rw-r--r--Master/texmf-dist/asymptote/three_surface.asy9
1 files changed, 6 insertions, 3 deletions
diff --git a/Master/texmf-dist/asymptote/three_surface.asy b/Master/texmf-dist/asymptote/three_surface.asy
index 0ef497f6d56..85d32b08eb6 100644
--- a/Master/texmf-dist/asymptote/three_surface.asy
+++ b/Master/texmf-dist/asymptote/three_surface.asy
@@ -321,9 +321,12 @@ patch operator * (transform3 t, patch s)
Si[j]=t*si[j];
}
- transform3 t0=shiftless(t);
- for(int i=0; i < s.normals.length; ++i)
- S.normals[i]=t0*s.normals[i];
+ if(s.normals.length > 0) {
+ transform3 t0=shiftless(t);
+ t0=determinant(t0) == 0 ? identity4 : transpose(inverse(t0));
+ for(int i=0; i < s.normals.length; ++i)
+ S.normals[i]=t0*s.normals[i];
+ }
S.colors=copy(s.colors);
S.planar=s.planar;