summaryrefslogtreecommitdiff
path: root/graphics/asymptote/bezierpatch.h
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-08-07 03:02:55 +0000
committerNorbert Preining <norbert@preining.info>2020-08-07 03:02:55 +0000
commit3710c23789342d9d88783cbe9ad23eb5263a7c33 (patch)
tree1c40b2bfb9f6b652f7877ad0991f5d6b44391154 /graphics/asymptote/bezierpatch.h
parentd99fea72e367e8d4d2809b43b3b0206b1bb526b8 (diff)
CTAN sync 202008070302
Diffstat (limited to 'graphics/asymptote/bezierpatch.h')
-rw-r--r--graphics/asymptote/bezierpatch.h26
1 files changed, 13 insertions, 13 deletions
diff --git a/graphics/asymptote/bezierpatch.h b/graphics/asymptote/bezierpatch.h
index 2af678f9f8..75ba7a66f9 100644
--- a/graphics/asymptote/bezierpatch.h
+++ b/graphics/asymptote/bezierpatch.h
@@ -30,7 +30,7 @@ struct BezierPatch
bool Onscreen;
void init(double res);
-
+
triple normal(triple left3, triple left2, triple left1, triple middle,
triple right1, triple right2, triple right3) {
triple lp=3.0*(left1-middle);
@@ -66,11 +66,11 @@ struct BezierPatch
triple p=p1-p0;
if(abs2(p) > epsilon)
return p;
-
+
p=bezierPP(p0,p1,p2);
if(abs2(p) > epsilon)
return p;
-
+
return bezierPPP(p0,p1,p2,p3);
}
@@ -96,10 +96,10 @@ struct BezierPatch
v=max(v,Straightness(p[4],p[5],p[6],p[7]));
v=max(v,Straightness(p[8],p[9],p[10],p[11]));
v=max(v,Straightness(p12,p[13],p[14],p15));
-
+
return pair(h,v);
}
-
+
struct Split3 {
triple m0,m2,m3,m4,m5;
Split3() {}
@@ -112,7 +112,7 @@ struct BezierPatch
m5=0.5*(m3+m4);
}
};
-
+
// Approximate bounds by bounding box of control polyhedron.
bool offscreen(size_t n, const triple *v) {
if(bbox2(n,v).offscreen()) {
@@ -129,7 +129,7 @@ struct BezierPatch
bool flat0, bool flat1, bool flat2, bool flat3,
GLfloat *C0=NULL, GLfloat *C1=NULL, GLfloat *C2=NULL,
GLfloat *C3=NULL);
-
+
void append() {
if(transparent)
transparentData.Append(data);
@@ -140,7 +140,7 @@ struct BezierPatch
materialData.append(data);
}
}
-
+
virtual void notRendered() {
if(transparent)
transparentData.rendered=false;
@@ -162,18 +162,18 @@ struct BezierPatch
init(pixel*ratio);
render(g,straight,colors);
}
-
+
};
struct BezierTriangle : public BezierPatch {
public:
BezierTriangle() : BezierPatch() {}
-
+
double Distance(const triple *p) {
triple p0=p[0];
triple p6=p[6];
triple p9=p[9];
-
+
// Check how far the internal point is from the centroid of the vertices.
double d=abs2((p0+p6+p9)*third-p[4]);
@@ -182,7 +182,7 @@ public:
d=max(d,Straightness(p0,p[2],p[5],p9));
return max(d,Straightness(p6,p[7],p[8],p9));
}
-
+
void render(const triple *p, bool straight, GLfloat *c0=NULL);
void render(const triple *p,
GLuint I0, GLuint I1, GLuint I2,
@@ -199,7 +199,7 @@ public:
size_t nC, const prc::RGBAColour* C, size_t nI,
const uint32_t (*PI)[3], const uint32_t (*NI)[3],
const uint32_t (*CI)[3], bool transparent);
-
+
void append() {
if(transparent)
transparentData.Append(data);