summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/bezierpatch.h
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-03-23 22:37:58 +0000
committerKarl Berry <karl@freefriends.org>2017-03-23 22:37:58 +0000
commit511d523f9c0456937f392cab51c70f0dcf6ae1bc (patch)
tree2575821a91e042c74a61c3cb6387cc769e0a0b87 /Build/source/utils/asymptote/bezierpatch.h
parent5db9b67730d1ad8391da2e18faa01062b64d1da0 (diff)
asy 2.41 sources
git-svn-id: svn://tug.org/texlive/trunk@43590 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/bezierpatch.h')
-rw-r--r--Build/source/utils/asymptote/bezierpatch.h20
1 files changed, 9 insertions, 11 deletions
diff --git a/Build/source/utils/asymptote/bezierpatch.h b/Build/source/utils/asymptote/bezierpatch.h
index 7c82d57df9d..826f65ac2c1 100644
--- a/Build/source/utils/asymptote/bezierpatch.h
+++ b/Build/source/utils/asymptote/bezierpatch.h
@@ -37,7 +37,8 @@ struct BezierPatch
triple u,v,w;
double epsilon;
double Epsilon;
- double res2,res3;
+ double res2;
+ double Res2; // Reduced resolution for Bezier triangles flatness test.
triple Min,Max;
typedef GLuint vertexFunction(const triple &v, const triple& n);
typedef GLuint VertexFunction(const triple &v, const triple& n, GLfloat *c);
@@ -149,15 +150,15 @@ struct BezierPatch
triple p12=p[12];
triple p15=p[15];
+ // Check the flatness of the quad.
+ double d=Distance2(p15,p0,normal(p3,p[2],p[1],p0,p[4],p[8],p12));
+
// Determine how straight the edges are.
- double d=Straightness(p0,p[1],p[2],p3);
+ d=max(d,Straightness(p0,p[1],p[2],p3));
d=max(d,Straightness(p0,p[4],p[8],p12));
d=max(d,Straightness(p3,p[7],p[11],p15));
d=max(d,Straightness(p12,p[13],p[14],p15));
- triple n0=normal(p3,p[2],p[1],p0,p[4],p[8],p12);
- d=max(d,Distance2(p15,p0,n0));
-
// Determine how straight the interior control curves are.
d=max(d,Straightness(p[4],p[5],p[6],p[7]));
d=max(d,Straightness(p[8],p[9],p[10],p[11]));
@@ -237,12 +238,9 @@ public:
triple p0=p[0];
triple p6=p[6];
triple p9=p[9];
-
- // Only the internal point is tested for deviance from the triangle
- // formed by the vertices. We assume that the Jacobian is nonzero so
- // that we only need to calculate the perpendicular distance of the
- // internal point from this triangle.
- double d=Distance2(p[4],p0,normal(p9,p[5],p[2],p0,p[1],p[3],p6));
+
+ // Check how far the internal point is from the centroid of the vertices.
+ double d=abs2((p0+p6+p9)*third-p[4]);
// Determine how straight the edges are.
d=max(d,Straightness(p0,p[1],p[3],p6));