summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/base/three_surface.asy
diff options
context:
space:
mode:
authorMojca Miklavec <mojca.miklavec@gmail.com>2014-05-17 18:06:46 +0000
committerMojca Miklavec <mojca.miklavec@gmail.com>2014-05-17 18:06:46 +0000
commit8e7ea45ebf7c1c4dbca970656d00684cc5d53720 (patch)
tree8c8a67fb417b3e9ccf6a4dcbd17361f8e36683f2 /Build/source/utils/asymptote/base/three_surface.asy
parent02783996c279399df9780678ce424ab563bfee73 (diff)
asy 2.31 sources
git-svn-id: svn://tug.org/texlive/trunk@34080 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/base/three_surface.asy')
-rw-r--r--Build/source/utils/asymptote/base/three_surface.asy34
1 files changed, 16 insertions, 18 deletions
diff --git a/Build/source/utils/asymptote/base/three_surface.asy b/Build/source/utils/asymptote/base/three_surface.asy
index fc09ac798d9..bf070e2a4a9 100644
--- a/Build/source/utils/asymptote/base/three_surface.asy
+++ b/Build/source/utils/asymptote/base/three_surface.asy
@@ -954,7 +954,7 @@ private triple[] split(triple z0, triple c0, triple c1, triple z1, real t=0.5)
// Return the control points of the subpatches
// produced by a horizontal split of P
-triple[][][] hsplit(triple[][] P)
+triple[][][] hsplit(triple[][] P, real v=0.5)
{
// get control points in rows
triple[] P0=P[0];
@@ -962,10 +962,10 @@ triple[][][] hsplit(triple[][] P)
triple[] P2=P[2];
triple[] P3=P[3];
- triple[] c0=split(P0[0],P0[1],P0[2],P0[3]);
- triple[] c1=split(P1[0],P1[1],P1[2],P1[3]);
- triple[] c2=split(P2[0],P2[1],P2[2],P2[3]);
- triple[] c3=split(P3[0],P3[1],P3[2],P3[3]);
+ triple[] c0=split(P0[0],P0[1],P0[2],P0[3],v);
+ triple[] c1=split(P1[0],P1[1],P1[2],P1[3],v);
+ triple[] c2=split(P2[0],P2[1],P2[2],P2[3],v);
+ triple[] c3=split(P3[0],P3[1],P3[2],P3[3],v);
// bottom, top
return new triple[][][] {
{{P0[0],c0[0],c0[1],c0[2]},
@@ -981,7 +981,7 @@ triple[][][] hsplit(triple[][] P)
// Return the control points of the subpatches
// produced by a vertical split of P
-triple[][][] vsplit(triple[][] P)
+triple[][][] vsplit(triple[][] P, real u=0.5)
{
// get control points in rows
triple[] P0=P[0];
@@ -989,10 +989,10 @@ triple[][][] vsplit(triple[][] P)
triple[] P2=P[2];
triple[] P3=P[3];
- triple[] c0=split(P0[0],P1[0],P2[0],P3[0]);
- triple[] c1=split(P0[1],P1[1],P2[1],P3[1]);
- triple[] c2=split(P0[2],P1[2],P2[2],P3[2]);
- triple[] c3=split(P0[3],P1[3],P2[3],P3[3]);
+ triple[] c0=split(P0[0],P1[0],P2[0],P3[0],u);
+ triple[] c1=split(P0[1],P1[1],P2[1],P3[1],u);
+ triple[] c2=split(P0[2],P1[2],P2[2],P3[2],u);
+ triple[] c3=split(P0[3],P1[3],P2[3],P3[3],u);
// left, right
return new triple[][][] {
{{P0[0],P0[1],P0[2],P0[3]},
@@ -1008,7 +1008,7 @@ triple[][][] vsplit(triple[][] P)
// Return a 2D array of the control point arrays of the subpatches
// produced by horizontal and vertical splits of P at u and v
-triple[][][][] split(triple[][] P, real u=1/2, real v=1/2)
+triple[][][][] split(triple[][] P, real u=0.5, real v=0.5)
{
triple[] P0=P[0];
triple[] P1=P[1];
@@ -1160,15 +1160,13 @@ triple[] intersectionpoints(path3 p, surface s, real fuzz=-1)
return sequence(new triple(int i) {return point(p,t[i][0]);},t.length);
}
-// Return true iff the bounding boxes of patch p and q overlap.
+// Return true iff the control point bounding boxes of patches p and q overlap.
bool overlap(triple[][] p, triple[][] q, real fuzz=-1)
{
- triple p0=p[0][0];
- triple q0=q[0][0];
- triple pmin=minbezier(p,p0);
- triple pmax=maxbezier(p,p0);
- triple qmin=minbezier(q,q0);
- triple qmax=maxbezier(q,q0);
+ triple pmin=minbound(p);
+ triple pmax=maxbound(p);
+ triple qmin=minbound(q);
+ triple qmax=maxbound(q);
static real Fuzz=1000*realEpsilon;
real fuzz=max(10*fuzz,Fuzz*max(abs(pmin),abs(pmax)));