Result of running tools/sanitize_source_files.py (which was added in https://codereview.appspot.com/6465078/)
This CL is part II of IV (I broke down the 1280 files into 4 CLs).
Review URL: https://codereview.appspot.com/6474054
git-svn-id: http://skia.googlecode.com/svn/trunk@5263 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/experimental/Intersection/ActiveEdge_Test.cpp b/experimental/Intersection/ActiveEdge_Test.cpp
index 5456155..d460ba0 100755
--- a/experimental/Intersection/ActiveEdge_Test.cpp
+++ b/experimental/Intersection/ActiveEdge_Test.cpp
@@ -52,7 +52,7 @@
return (check.fY - lh.fAbove.fY) * (lh.fBelow.fX - lh.fAbove.fX)
< (lh.fBelow.fY - lh.fAbove.fY) * (check.fX - lh.fAbove.fX);
}
- const SkPoint& check = lh.fBelow.fY <= rh.fBelow.fY
+ const SkPoint& check = lh.fBelow.fY <= rh.fBelow.fY
&& lh.fBelow != rh.fBelow ? lh.fBelow : lh.fAbove;
return (rh.fBelow.fY - rh.fAbove.fY) * (check.fX - rh.fAbove.fX)
< (check.fY - rh.fAbove.fY) * (rh.fBelow.fX - rh.fAbove.fX);
@@ -66,7 +66,7 @@
right.fWorkEdge.fEdge = &rightIn;
for (size_t x = 0; x < leftRightCount; ++x) {
left.fAbove = leftRight[x][0];
- left.fTangent = left.fBelow = leftRight[x][1];
+ left.fTangent = left.fBelow = leftRight[x][1];
right.fAbove = leftRight[x][2];
right.fTangent = right.fBelow = leftRight[x][3];
SkASSERT(left < right);
diff --git a/experimental/Intersection/ConvexHull.cpp b/experimental/Intersection/ConvexHull.cpp
index 1551720..f291e74 100644
--- a/experimental/Intersection/ConvexHull.cpp
+++ b/experimental/Intersection/ConvexHull.cpp
@@ -5,12 +5,12 @@
/* Given a cubic, find the convex hull described by the end and control points.
The hull may have 3 or 4 points. Cubics that degenerate into a point or line
are not considered.
-
+
The hull is computed by assuming that three points, if unique and non-linear,
form a triangle. The fourth point may replace one of the first three, may be
discarded if in the triangle or on an edge, or may be inserted between any of
the three to form a convex quadralateral.
-
+
The indices returned in order describe the convex hull.
*/
int convex_hull(const Cubic& cubic, char order[4]) {
@@ -71,7 +71,7 @@
int most = midX ^ mask;
order[0] = yMin;
order[1] = least;
-
+
// see if mid value is on same side of line (least, most) as yMin
Cubic midPath;
if (!rotate(cubic, least, most, midPath)) { // ! if cbc[least]==cbc[most]
@@ -80,7 +80,7 @@
}
int midSides = side(midPath[yMin].y - midPath[least].y);
midSides ^= side(midPath[midX].y - midPath[least].y);
- if (midSides != 2) { // if mid point is not between
+ if (midSides != 2) { // if mid point is not between
order[2] = most;
return 3; // result is a triangle
}
@@ -91,10 +91,10 @@
/* Find the convex hull for cubics with the x-axis interval regularly spaced.
Cubics computed as distance functions are formed this way.
-
+
connectTo0[0], connectTo0[1] are the point indices that cubic[0] connects to.
connectTo3[0], connectTo3[1] are the point indices that cubic[3] connects to.
-
+
Returns true if cubic[1] to cubic[2] also forms part of the hull.
*/
bool convex_x_hull(const Cubic& cubic, char connectTo0[2], char connectTo3[2]) {
diff --git a/experimental/Intersection/ConvexHull_Test.cpp b/experimental/Intersection/ConvexHull_Test.cpp
index 4eb524b..a350391 100644
--- a/experimental/Intersection/ConvexHull_Test.cpp
+++ b/experimental/Intersection/ConvexHull_Test.cpp
@@ -46,17 +46,17 @@
{{1, 0}, {2, 0}, {0, 1}, {0, 0}},
{{2, 0}, {0, 1}, {0, 0}, {1, 0}},
{{0, 1}, {0, 0}, {1, 0}, {2, 0}},
-
+
{{0, 0}, {0, 1}, {0, 2}, {1, 1}}, // extra point on vert
{{0, 1}, {0, 2}, {1, 1}, {0, 0}},
{{0, 2}, {1, 1}, {0, 0}, {0, 1}},
{{1, 1}, {0, 0}, {0, 1}, {0, 2}},
-
+
{{0, 0}, {1, 1}, {2, 2}, {2, 0}}, // extra point on diag
{{1, 1}, {2, 2}, {2, 0}, {0, 0}},
{{2, 2}, {2, 0}, {0, 0}, {1, 1}},
{{2, 0}, {0, 0}, {1, 1}, {2, 2}},
-
+
{{0, 0}, {2, 0}, {2, 2}, {1, 1}}, // extra point on diag
{{2, 0}, {2, 2}, {1, 1}, {0, 0}},
{{2, 2}, {1, 1}, {0, 0}, {2, 0}},
@@ -99,9 +99,9 @@
static void transform(const Cubic& cubic, const Matrix3x2& matrix, Cubic& rotPath) {
for (int index = 0; index < 4; ++index) {
- rotPath[index].x = cubic[index].x * matrix[0][0]
+ rotPath[index].x = cubic[index].x * matrix[0][0]
+ cubic[index].y * matrix[1][0] + matrix[2][0];
- rotPath[index].y = cubic[index].x * matrix[0][1]
+ rotPath[index].y = cubic[index].x * matrix[0][1]
+ cubic[index].y * matrix[1][1] + matrix[2][1];
}
}
@@ -146,7 +146,7 @@
for (int index = 0; index < 4; ++index) {
if (debug_rotate_to_hull) printf("(%g,%g) ", rotPath[index].x, rotPath[index].y);
sides[side(rotPath[index].y - rotPath[inner].y)]++;
- if (index != outer && index != inner
+ if (index != outer && index != inner
&& side(rotPath[index].y - rotPath[inner].y) == 1)
zeroes = index;
}
@@ -169,13 +169,13 @@
__FUNCTION__, (int)idx, (int)inr, (int)outer, (int)inner);
continue;
}
- if (rotPath[zeroes].x < rotPath[inner].x
+ if (rotPath[zeroes].x < rotPath[inner].x
&& rotPath[zeroes].x < rotPath[outer].x) {
if (debug_rotate_to_hull) printf("%s [%d,%d] [o=%d,i=%d] zeroes < inner && outer\n",
__FUNCTION__, (int)idx, (int)inr, (int)outer, (int)inner);
continue;
}
- if (rotPath[zeroes].x > rotPath[inner].x
+ if (rotPath[zeroes].x > rotPath[inner].x
&& rotPath[zeroes].x > rotPath[outer].x) {
if (debug_rotate_to_hull) printf("%s [%d,%d] [o=%d,i=%d] zeroes > inner && outer\n",
__FUNCTION__, (int)idx, (int)inr, (int)outer, (int)inner);
@@ -242,7 +242,7 @@
for (pt = 0; pt < cmp; ++pt) {
if (pts & 1 << order[pt]) {
printf("%s [%d,%d] duplicate index in order: %d,%d,%d",
- __FUNCTION__, (int)index, (int)inner,
+ __FUNCTION__, (int)index, (int)inner,
order[0], order[1], order[2]);
if (cmp == 4) {
printf(",%d", order[3]);
@@ -252,7 +252,7 @@
}
if (cmpPts & 1 << cmpOrder[pt]) {
printf("%s [%d,%d] duplicate index in order: %d,%d,%d",
- __FUNCTION__, (int)index, (int)inner,
+ __FUNCTION__, (int)index, (int)inner,
cmpOrder[0], cmpOrder[1], cmpOrder[2]);
if (cmp == 4) {
printf(",%d", cmpOrder[3]);
@@ -291,7 +291,7 @@
}
if (pts != cmpPts) {
printf("%s [%d,%d] mismatch indices: order=%d,%d,%d",
- __FUNCTION__, (int)index, (int)inner,
+ __FUNCTION__, (int)index, (int)inner,
order[0], order[1], order[2]);
if (cmp == 4) {
printf(",%d", order[3]);
@@ -311,7 +311,7 @@
if (cmpOrder[match ^ 2] != order[2]) {
printf("%s [%d,%d] bowtie mismatch: order=%d,%d,%d,%d"
" cmpOrder=%d,%d,%d,%d\n",
- __FUNCTION__, (int)index, (int)inner,
+ __FUNCTION__, (int)index, (int)inner,
order[0], order[1], order[2], order[3],
cmpOrder[0], cmpOrder[1], cmpOrder[2], cmpOrder[3]);
}
@@ -383,10 +383,10 @@
}
for (idx = 0; idx < cmp; ++idx) {
if (cmpOrder[idx] == 0) {
- rOrder[0] = cmpOrder[(idx + 1) % cmp];
+ rOrder[0] = cmpOrder[(idx + 1) % cmp];
rOrder[1] = cmpOrder[(idx + cmp - 1) % cmp];
} else if (cmpOrder[idx] == 3) {
- rOrder[2] = cmpOrder[(idx + 1) % cmp];
+ rOrder[2] = cmpOrder[(idx + 1) % cmp];
rOrder[3] = cmpOrder[(idx + cmp - 1) % cmp];
}
}
diff --git a/experimental/Intersection/CubeRoot.cpp b/experimental/Intersection/CubeRoot.cpp
index 37c8844..4f602f7 100644
--- a/experimental/Intersection/CubeRoot.cpp
+++ b/experimental/Intersection/CubeRoot.cpp
@@ -1,4 +1,4 @@
-// http://metamerist.com/cbrt/CubeRoot.cpp
+// http://metamerist.com/cbrt/CubeRoot.cpp
//
#include <math.h>
@@ -12,102 +12,102 @@
// estimate bits of precision (32-bit float case)
inline int bits_of_precision(float a, float b)
{
- const double kd = 1.0 / log(2.0);
+ const double kd = 1.0 / log(2.0);
- if (a==b)
- return 23;
+ if (a==b)
+ return 23;
- const double kdmin = pow(2.0, -23.0);
+ const double kdmin = pow(2.0, -23.0);
- double d = fabs(a-b);
- if (d < kdmin)
- return 23;
+ double d = fabs(a-b);
+ if (d < kdmin)
+ return 23;
- return int(-log(d)*kd);
+ return int(-log(d)*kd);
}
// estiamte bits of precision (64-bit double case)
inline int bits_of_precision(double a, double b)
{
- const double kd = 1.0 / log(2.0);
+ const double kd = 1.0 / log(2.0);
- if (a==b)
- return 52;
+ if (a==b)
+ return 52;
- const double kdmin = pow(2.0, -52.0);
+ const double kdmin = pow(2.0, -52.0);
- double d = fabs(a-b);
- if (d < kdmin)
- return 52;
+ double d = fabs(a-b);
+ if (d < kdmin)
+ return 52;
- return int(-log(d)*kd);
+ return int(-log(d)*kd);
}
// cube root via x^(1/3)
static float pow_cbrtf(float x)
{
- return (float) pow(x, 1.0f/3.0f);
+ return (float) pow(x, 1.0f/3.0f);
}
// cube root via x^(1/3)
static double pow_cbrtd(double x)
{
- return pow(x, 1.0/3.0);
+ return pow(x, 1.0/3.0);
}
// cube root approximation using bit hack for 32-bit float
static float cbrt_5f(float f)
{
- unsigned int* p = (unsigned int *) &f;
- *p = *p/3 + 709921077;
- return f;
+ unsigned int* p = (unsigned int *) &f;
+ *p = *p/3 + 709921077;
+ return f;
}
#endif
-// cube root approximation using bit hack for 64-bit float
+// cube root approximation using bit hack for 64-bit float
// adapted from Kahan's cbrt
static double cbrt_5d(double d)
{
- const unsigned int B1 = 715094163;
- double t = 0.0;
- unsigned int* pt = (unsigned int*) &t;
- unsigned int* px = (unsigned int*) &d;
- pt[1]=px[1]/3+B1;
- return t;
+ const unsigned int B1 = 715094163;
+ double t = 0.0;
+ unsigned int* pt = (unsigned int*) &t;
+ unsigned int* px = (unsigned int*) &d;
+ pt[1]=px[1]/3+B1;
+ return t;
}
#if TEST_ALTERNATIVES
-// cube root approximation using bit hack for 64-bit float
+// cube root approximation using bit hack for 64-bit float
// adapted from Kahan's cbrt
#if 0
static double quint_5d(double d)
{
- return sqrt(sqrt(d));
+ return sqrt(sqrt(d));
- const unsigned int B1 = 71509416*5/3;
- double t = 0.0;
- unsigned int* pt = (unsigned int*) &t;
- unsigned int* px = (unsigned int*) &d;
- pt[1]=px[1]/5+B1;
- return t;
+ const unsigned int B1 = 71509416*5/3;
+ double t = 0.0;
+ unsigned int* pt = (unsigned int*) &t;
+ unsigned int* px = (unsigned int*) &d;
+ pt[1]=px[1]/5+B1;
+ return t;
}
#endif
// iterative cube root approximation using Halley's method (float)
static float cbrta_halleyf(const float a, const float R)
{
- const float a3 = a*a*a;
+ const float a3 = a*a*a;
const float b= a * (a3 + R + R) / (a3 + a3 + R);
- return b;
+ return b;
}
#endif
// iterative cube root approximation using Halley's method (double)
static double cbrta_halleyd(const double a, const double R)
{
- const double a3 = a*a*a;
+ const double a3 = a*a*a;
const double b= a * (a3 + R + R) / (a3 + a3 + R);
- return b;
+ return b;
}
#if TEST_ALTERNATIVES
@@ -115,255 +115,255 @@
static float cbrta_newtonf(const float a, const float x)
{
// return (1.0 / 3.0) * ((a + a) + x / (a * a));
- return a - (1.0f / 3.0f) * (a - x / (a*a));
+ return a - (1.0f / 3.0f) * (a - x / (a*a));
}
// iterative cube root approximation using Newton's method (double)
static double cbrta_newtond(const double a, const double x)
{
- return (1.0/3.0) * (x / (a*a) + 2*a);
+ return (1.0/3.0) * (x / (a*a) + 2*a);
}
// cube root approximation using 1 iteration of Halley's method (double)
static double halley_cbrt1d(double d)
{
- double a = cbrt_5d(d);
- return cbrta_halleyd(a, d);
+ double a = cbrt_5d(d);
+ return cbrta_halleyd(a, d);
}
// cube root approximation using 1 iteration of Halley's method (float)
static float halley_cbrt1f(float d)
{
- float a = cbrt_5f(d);
- return cbrta_halleyf(a, d);
+ float a = cbrt_5f(d);
+ return cbrta_halleyf(a, d);
}
// cube root approximation using 2 iterations of Halley's method (double)
static double halley_cbrt2d(double d)
{
- double a = cbrt_5d(d);
- a = cbrta_halleyd(a, d);
- return cbrta_halleyd(a, d);
+ double a = cbrt_5d(d);
+ a = cbrta_halleyd(a, d);
+ return cbrta_halleyd(a, d);
}
#endif
// cube root approximation using 3 iterations of Halley's method (double)
static double halley_cbrt3d(double d)
{
- double a = cbrt_5d(d);
- a = cbrta_halleyd(a, d);
- a = cbrta_halleyd(a, d);
- return cbrta_halleyd(a, d);
+ double a = cbrt_5d(d);
+ a = cbrta_halleyd(a, d);
+ a = cbrta_halleyd(a, d);
+ return cbrta_halleyd(a, d);
}
#if TEST_ALTERNATIVES
// cube root approximation using 2 iterations of Halley's method (float)
static float halley_cbrt2f(float d)
{
- float a = cbrt_5f(d);
- a = cbrta_halleyf(a, d);
- return cbrta_halleyf(a, d);
+ float a = cbrt_5f(d);
+ a = cbrta_halleyf(a, d);
+ return cbrta_halleyf(a, d);
}
// cube root approximation using 1 iteration of Newton's method (double)
static double newton_cbrt1d(double d)
{
- double a = cbrt_5d(d);
- return cbrta_newtond(a, d);
+ double a = cbrt_5d(d);
+ return cbrta_newtond(a, d);
}
// cube root approximation using 2 iterations of Newton's method (double)
static double newton_cbrt2d(double d)
{
- double a = cbrt_5d(d);
- a = cbrta_newtond(a, d);
- return cbrta_newtond(a, d);
+ double a = cbrt_5d(d);
+ a = cbrta_newtond(a, d);
+ return cbrta_newtond(a, d);
}
// cube root approximation using 3 iterations of Newton's method (double)
static double newton_cbrt3d(double d)
{
- double a = cbrt_5d(d);
- a = cbrta_newtond(a, d);
- a = cbrta_newtond(a, d);
- return cbrta_newtond(a, d);
+ double a = cbrt_5d(d);
+ a = cbrta_newtond(a, d);
+ a = cbrta_newtond(a, d);
+ return cbrta_newtond(a, d);
}
// cube root approximation using 4 iterations of Newton's method (double)
static double newton_cbrt4d(double d)
{
- double a = cbrt_5d(d);
- a = cbrta_newtond(a, d);
- a = cbrta_newtond(a, d);
- a = cbrta_newtond(a, d);
- return cbrta_newtond(a, d);
+ double a = cbrt_5d(d);
+ a = cbrta_newtond(a, d);
+ a = cbrta_newtond(a, d);
+ a = cbrta_newtond(a, d);
+ return cbrta_newtond(a, d);
}
// cube root approximation using 2 iterations of Newton's method (float)
static float newton_cbrt1f(float d)
{
- float a = cbrt_5f(d);
- return cbrta_newtonf(a, d);
+ float a = cbrt_5f(d);
+ return cbrta_newtonf(a, d);
}
// cube root approximation using 2 iterations of Newton's method (float)
static float newton_cbrt2f(float d)
{
- float a = cbrt_5f(d);
- a = cbrta_newtonf(a, d);
- return cbrta_newtonf(a, d);
+ float a = cbrt_5f(d);
+ a = cbrta_newtonf(a, d);
+ return cbrta_newtonf(a, d);
}
// cube root approximation using 3 iterations of Newton's method (float)
static float newton_cbrt3f(float d)
{
- float a = cbrt_5f(d);
- a = cbrta_newtonf(a, d);
- a = cbrta_newtonf(a, d);
- return cbrta_newtonf(a, d);
+ float a = cbrt_5f(d);
+ a = cbrta_newtonf(a, d);
+ a = cbrta_newtonf(a, d);
+ return cbrta_newtonf(a, d);
}
// cube root approximation using 4 iterations of Newton's method (float)
static float newton_cbrt4f(float d)
{
- float a = cbrt_5f(d);
- a = cbrta_newtonf(a, d);
- a = cbrta_newtonf(a, d);
- a = cbrta_newtonf(a, d);
- return cbrta_newtonf(a, d);
+ float a = cbrt_5f(d);
+ a = cbrta_newtonf(a, d);
+ a = cbrta_newtonf(a, d);
+ a = cbrta_newtonf(a, d);
+ return cbrta_newtonf(a, d);
}
static double TestCubeRootf(const char* szName, cuberootfnf cbrt, double rA, double rB, int rN)
{
- const int N = rN;
-
- float dd = float((rB-rA) / N);
+ const int N = rN;
- // calculate 1M numbers
- int i=0;
- float d = (float) rA;
+ float dd = float((rB-rA) / N);
- double s = 0.0;
+ // calculate 1M numbers
+ int i=0;
+ float d = (float) rA;
- for(d=(float) rA, i=0; i<N; i++, d += dd)
- {
- s += cbrt(d);
- }
+ double s = 0.0;
- double bits = 0.0;
- double worstx=0.0;
- double worsty=0.0;
- int minbits=64;
+ for(d=(float) rA, i=0; i<N; i++, d += dd)
+ {
+ s += cbrt(d);
+ }
- for(d=(float) rA, i=0; i<N; i++, d += dd)
- {
- float a = cbrt((float) d);
- float b = (float) pow((double) d, 1.0/3.0);
+ double bits = 0.0;
+ double worstx=0.0;
+ double worsty=0.0;
+ int minbits=64;
- int bc = bits_of_precision(a, b);
- bits += bc;
+ for(d=(float) rA, i=0; i<N; i++, d += dd)
+ {
+ float a = cbrt((float) d);
+ float b = (float) pow((double) d, 1.0/3.0);
- if (b > 1.0e-6)
- {
- if (bc < minbits)
- {
- minbits = bc;
- worstx = d;
- worsty = a;
- }
- }
- }
+ int bc = bits_of_precision(a, b);
+ bits += bc;
- bits /= N;
+ if (b > 1.0e-6)
+ {
+ if (bc < minbits)
+ {
+ minbits = bc;
+ worstx = d;
+ worsty = a;
+ }
+ }
+ }
+
+ bits /= N;
printf(" %3d mbp %6.3f abp\n", minbits, bits);
- return s;
+ return s;
}
static double TestCubeRootd(const char* szName, cuberootfnd cbrt, double rA, double rB, int rN)
{
- const int N = rN;
-
- double dd = (rB-rA) / N;
+ const int N = rN;
- int i=0;
-
- double s = 0.0;
- double d = 0.0;
+ double dd = (rB-rA) / N;
- for(d=rA, i=0; i<N; i++, d += dd)
- {
- s += cbrt(d);
- }
+ int i=0;
+
+ double s = 0.0;
+ double d = 0.0;
+
+ for(d=rA, i=0; i<N; i++, d += dd)
+ {
+ s += cbrt(d);
+ }
- double bits = 0.0;
- double worstx = 0.0;
- double worsty = 0.0;
- int minbits = 64;
- for(d=rA, i=0; i<N; i++, d += dd)
- {
- double a = cbrt(d);
- double b = pow(d, 1.0/3.0);
+ double bits = 0.0;
+ double worstx = 0.0;
+ double worsty = 0.0;
+ int minbits = 64;
+ for(d=rA, i=0; i<N; i++, d += dd)
+ {
+ double a = cbrt(d);
+ double b = pow(d, 1.0/3.0);
- int bc = bits_of_precision(a, b); // min(53, count_matching_bitsd(a, b) - 12);
- bits += bc;
+ int bc = bits_of_precision(a, b); // min(53, count_matching_bitsd(a, b) - 12);
+ bits += bc;
- if (b > 1.0e-6)
- {
- if (bc < minbits)
- {
- bits_of_precision(a, b);
- minbits = bc;
- worstx = d;
- worsty = a;
- }
- }
- }
+ if (b > 1.0e-6)
+ {
+ if (bc < minbits)
+ {
+ bits_of_precision(a, b);
+ minbits = bc;
+ worstx = d;
+ worsty = a;
+ }
+ }
+ }
- bits /= N;
+ bits /= N;
printf(" %3d mbp %6.3f abp\n", minbits, bits);
- return s;
+ return s;
}
static int _tmain()
{
- // a million uniform steps through the range from 0.0 to 1.0
- // (doing uniform steps in the log scale would be better)
- double a = 0.0;
- double b = 1.0;
- int n = 1000000;
+ // a million uniform steps through the range from 0.0 to 1.0
+ // (doing uniform steps in the log scale would be better)
+ double a = 0.0;
+ double b = 1.0;
+ int n = 1000000;
- printf("32-bit float tests\n");
- printf("----------------------------------------\n");
- TestCubeRootf("cbrt_5f", cbrt_5f, a, b, n);
- TestCubeRootf("pow", pow_cbrtf, a, b, n);
- TestCubeRootf("halley x 1", halley_cbrt1f, a, b, n);
- TestCubeRootf("halley x 2", halley_cbrt2f, a, b, n);
- TestCubeRootf("newton x 1", newton_cbrt1f, a, b, n);
- TestCubeRootf("newton x 2", newton_cbrt2f, a, b, n);
- TestCubeRootf("newton x 3", newton_cbrt3f, a, b, n);
- TestCubeRootf("newton x 4", newton_cbrt4f, a, b, n);
- printf("\n\n");
+ printf("32-bit float tests\n");
+ printf("----------------------------------------\n");
+ TestCubeRootf("cbrt_5f", cbrt_5f, a, b, n);
+ TestCubeRootf("pow", pow_cbrtf, a, b, n);
+ TestCubeRootf("halley x 1", halley_cbrt1f, a, b, n);
+ TestCubeRootf("halley x 2", halley_cbrt2f, a, b, n);
+ TestCubeRootf("newton x 1", newton_cbrt1f, a, b, n);
+ TestCubeRootf("newton x 2", newton_cbrt2f, a, b, n);
+ TestCubeRootf("newton x 3", newton_cbrt3f, a, b, n);
+ TestCubeRootf("newton x 4", newton_cbrt4f, a, b, n);
+ printf("\n\n");
- printf("64-bit double tests\n");
- printf("----------------------------------------\n");
- TestCubeRootd("cbrt_5d", cbrt_5d, a, b, n);
- TestCubeRootd("pow", pow_cbrtd, a, b, n);
- TestCubeRootd("halley x 1", halley_cbrt1d, a, b, n);
- TestCubeRootd("halley x 2", halley_cbrt2d, a, b, n);
- TestCubeRootd("halley x 3", halley_cbrt3d, a, b, n);
- TestCubeRootd("newton x 1", newton_cbrt1d, a, b, n);
- TestCubeRootd("newton x 2", newton_cbrt2d, a, b, n);
- TestCubeRootd("newton x 3", newton_cbrt3d, a, b, n);
- TestCubeRootd("newton x 4", newton_cbrt4d, a, b, n);
- printf("\n\n");
+ printf("64-bit double tests\n");
+ printf("----------------------------------------\n");
+ TestCubeRootd("cbrt_5d", cbrt_5d, a, b, n);
+ TestCubeRootd("pow", pow_cbrtd, a, b, n);
+ TestCubeRootd("halley x 1", halley_cbrt1d, a, b, n);
+ TestCubeRootd("halley x 2", halley_cbrt2d, a, b, n);
+ TestCubeRootd("halley x 3", halley_cbrt3d, a, b, n);
+ TestCubeRootd("newton x 1", newton_cbrt1d, a, b, n);
+ TestCubeRootd("newton x 2", newton_cbrt2d, a, b, n);
+ TestCubeRootd("newton x 3", newton_cbrt3d, a, b, n);
+ TestCubeRootd("newton x 4", newton_cbrt4d, a, b, n);
+ printf("\n\n");
- return 0;
+ return 0;
}
#endif
diff --git a/experimental/Intersection/CubicBezierClip.cpp b/experimental/Intersection/CubicBezierClip.cpp
index 4eddc70..f3c78a2 100644
--- a/experimental/Intersection/CubicBezierClip.cpp
+++ b/experimental/Intersection/CubicBezierClip.cpp
@@ -10,7 +10,7 @@
maxT = 0;
// determine normalized implicit line equation for pt[0] to pt[3]
// of the form ax + by + c = 0, where a*a + b*b == 1
-
+
// find the implicit line equation parameters
LineParameters endLine;
endLine.cubicEndPoints(cubic1);
@@ -21,7 +21,7 @@
double distance[2];
endLine.controlPtDistance(cubic1, distance);
-
+
// find fat line
double top = distance[0];
double bottom = distance[1];
@@ -42,11 +42,11 @@
top *= scale;
bottom *= scale;
}
-
+
// compute intersecting candidate distance
Cubic distance2y; // points with X of (0, 1/3, 2/3, 1)
endLine.cubicDistanceY(cubic2, distance2y);
-
+
int flags = 0;
if (approximately_lesser(distance2y[0].y, top)) {
flags |= kFindTopMin;
@@ -78,7 +78,7 @@
if (do_1_2_edge) {
x_at(distance2y[1], distance2y[2], top, bottom, flags, minT, maxT);
}
-
+
return minT < maxT; // returns false if distance shows no intersection
}
diff --git a/experimental/Intersection/CubicIntersection.cpp b/experimental/Intersection/CubicIntersection.cpp
index 13c4726..594e12c 100644
--- a/experimental/Intersection/CubicIntersection.cpp
+++ b/experimental/Intersection/CubicIntersection.cpp
@@ -6,11 +6,11 @@
class CubicIntersections : public Intersections {
public:
-CubicIntersections(const Cubic& c1, const Cubic& c2, Intersections& i)
+CubicIntersections(const Cubic& c1, const Cubic& c2, Intersections& i)
: cubic1(c1)
, cubic2(c2)
, intersections(i)
- , depth(0)
+ , depth(0)
, splits(0) {
}
@@ -37,10 +37,10 @@
}
protected:
-
+
bool intersect(double minT1, double maxT1, double minT2, double maxT2) {
Cubic smaller, larger;
- // FIXME: carry last subdivide and reduceOrder result with cubic
+ // FIXME: carry last subdivide and reduceOrder result with cubic
sub_divide(cubic1, minT1, maxT1, intersections.swapped() ? larger : smaller);
sub_divide(cubic2, minT2, maxT2, intersections.swapped() ? smaller : larger);
Cubic smallResult;
@@ -58,11 +58,11 @@
return false;
}
if (intersections.swapped()) {
- smallT[0] = interp(minT2, maxT2, smallT[0]);
- largeT[0] = interp(minT1, maxT1, largeT[0]);
+ smallT[0] = interp(minT2, maxT2, smallT[0]);
+ largeT[0] = interp(minT1, maxT1, largeT[0]);
} else {
- smallT[0] = interp(minT1, maxT1, smallT[0]);
- largeT[0] = interp(minT2, maxT2, largeT[0]);
+ smallT[0] = interp(minT1, maxT1, smallT[0]);
+ largeT[0] = interp(minT2, maxT2, largeT[0]);
}
intersections.add(smallT[0], largeT[0]);
return true;
@@ -83,7 +83,7 @@
}
return false;
}
-
+
int split;
if (intersections.swapped()) {
double newMinT1 = interp(minT1, maxT1, minT);
diff --git a/experimental/Intersection/CubicIntersection_TestData.cpp b/experimental/Intersection/CubicIntersection_TestData.cpp
index 066d9b5..e1da4c5 100644
--- a/experimental/Intersection/CubicIntersection_TestData.cpp
+++ b/experimental/Intersection/CubicIntersection_TestData.cpp
@@ -12,7 +12,7 @@
};
const size_t pointDegenerates_count = sizeof(pointDegenerates) / sizeof(pointDegenerates[0]);
-
+
const Cubic notPointDegenerates[] = {
{{1 + PointEpsilon + std::numeric_limits<double>::epsilon(), 1}, {1, 1 + PointEpsilon}, {1, 1}, {1, 1}},
{{1 + PointEpsilon/2 + std::numeric_limits<double>::epsilon(), 1}, {1 - PointEpsilon/2, 1}, {1, 1}, {1, 1}}
@@ -69,7 +69,7 @@
{{317.122, 309.05}, {316.112, 315.102}, {310.385, 319.19}, {304.332, 318.179}}
},
{
- {{1046.604051, 172.937967}, {1046.604051, 178.9763059}, {1041.76745, 183.9279165}, {1035.703842, 184.0432409}},
+ {{1046.604051, 172.937967}, {1046.604051, 178.9763059}, {1041.76745, 183.9279165}, {1035.703842, 184.0432409}},
{{1046.452235, 174.7640504}, {1045.544872, 180.1973817}, {1040.837966, 184.0469882}, {1035.505925, 184.0469882}}
},
{
@@ -81,7 +81,7 @@
const size_t tests_count = sizeof(tests) / sizeof(tests[0]);
Cubic hexTests[][2] = {
- {
+ {
{{0}} // placeholder for hex converted below
}
};
@@ -95,7 +95,7 @@
},
{
0x92c56ed7b6145d40LLU, 0xede4f1255edb7740LLU, 0x1138c1101af75940LLU, 0x42e4f1255edb7740LLU,
- 0x408e51603ad95640LLU, 0x1e2e8fe9dd927740LLU, 0x1cb4777cd3a75440LLU, 0x212e1390de017740LLU
+ 0x408e51603ad95640LLU, 0x1e2e8fe9dd927740LLU, 0x1cb4777cd3a75440LLU, 0x212e1390de017740LLU
}
};
diff --git a/experimental/Intersection/CubicParameterization.cpp b/experimental/Intersection/CubicParameterization.cpp
index bb75771..7656c66 100644
--- a/experimental/Intersection/CubicParameterization.cpp
+++ b/experimental/Intersection/CubicParameterization.cpp
@@ -3,7 +3,7 @@
/* from http://tom.cs.byu.edu/~tom/papers/cvgip84.pdf 4.1
*
- * This paper proves that Syvester's method can compute the implicit form of
+ * This paper proves that Syvester's method can compute the implicit form of
* the quadratic from the parameterzied form.
*
* Given x = a*t*t*t + b*t*t + c*t + d (the parameterized form)
@@ -28,30 +28,30 @@
*
* Resultant[a*t^3 + b*t^2 + c*t + d - x, e*t^3 + f*t^2 + g*t + h - y, t]
*
- * -d^3 e^3 + c d^2 e^2 f - b d^2 e f^2 + a d^2 f^3 - c^2 d e^2 g +
- * 2 b d^2 e^2 g + b c d e f g - 3 a d^2 e f g - a c d f^2 g -
- * b^2 d e g^2 + 2 a c d e g^2 + a b d f g^2 - a^2 d g^3 + c^3 e^2 h -
- * 3 b c d e^2 h + 3 a d^2 e^2 h - b c^2 e f h + 2 b^2 d e f h +
- * a c d e f h + a c^2 f^2 h - 2 a b d f^2 h + b^2 c e g h -
- * 2 a c^2 e g h - a b d e g h - a b c f g h + 3 a^2 d f g h +
- * a^2 c g^2 h - b^3 e h^2 + 3 a b c e h^2 - 3 a^2 d e h^2 +
- * a b^2 f h^2 - 2 a^2 c f h^2 - a^2 b g h^2 + a^3 h^3 + 3 d^2 e^3 x -
- * 2 c d e^2 f x + 2 b d e f^2 x - 2 a d f^3 x + c^2 e^2 g x -
- * 4 b d e^2 g x - b c e f g x + 6 a d e f g x + a c f^2 g x +
- * b^2 e g^2 x - 2 a c e g^2 x - a b f g^2 x + a^2 g^3 x +
- * 3 b c e^2 h x - 6 a d e^2 h x - 2 b^2 e f h x - a c e f h x +
- * 2 a b f^2 h x + a b e g h x - 3 a^2 f g h x + 3 a^2 e h^2 x -
- * 3 d e^3 x^2 + c e^2 f x^2 - b e f^2 x^2 + a f^3 x^2 +
- * 2 b e^2 g x^2 - 3 a e f g x^2 + 3 a e^2 h x^2 + e^3 x^3 -
- * c^3 e^2 y + 3 b c d e^2 y - 3 a d^2 e^2 y + b c^2 e f y -
- * 2 b^2 d e f y - a c d e f y - a c^2 f^2 y + 2 a b d f^2 y -
- * b^2 c e g y + 2 a c^2 e g y + a b d e g y + a b c f g y -
- * 3 a^2 d f g y - a^2 c g^2 y + 2 b^3 e h y - 6 a b c e h y +
- * 6 a^2 d e h y - 2 a b^2 f h y + 4 a^2 c f h y + 2 a^2 b g h y -
- * 3 a^3 h^2 y - 3 b c e^2 x y + 6 a d e^2 x y + 2 b^2 e f x y +
- * a c e f x y - 2 a b f^2 x y - a b e g x y + 3 a^2 f g x y -
- * 6 a^2 e h x y - 3 a e^2 x^2 y - b^3 e y^2 + 3 a b c e y^2 -
- * 3 a^2 d e y^2 + a b^2 f y^2 - 2 a^2 c f y^2 - a^2 b g y^2 +
+ * -d^3 e^3 + c d^2 e^2 f - b d^2 e f^2 + a d^2 f^3 - c^2 d e^2 g +
+ * 2 b d^2 e^2 g + b c d e f g - 3 a d^2 e f g - a c d f^2 g -
+ * b^2 d e g^2 + 2 a c d e g^2 + a b d f g^2 - a^2 d g^3 + c^3 e^2 h -
+ * 3 b c d e^2 h + 3 a d^2 e^2 h - b c^2 e f h + 2 b^2 d e f h +
+ * a c d e f h + a c^2 f^2 h - 2 a b d f^2 h + b^2 c e g h -
+ * 2 a c^2 e g h - a b d e g h - a b c f g h + 3 a^2 d f g h +
+ * a^2 c g^2 h - b^3 e h^2 + 3 a b c e h^2 - 3 a^2 d e h^2 +
+ * a b^2 f h^2 - 2 a^2 c f h^2 - a^2 b g h^2 + a^3 h^3 + 3 d^2 e^3 x -
+ * 2 c d e^2 f x + 2 b d e f^2 x - 2 a d f^3 x + c^2 e^2 g x -
+ * 4 b d e^2 g x - b c e f g x + 6 a d e f g x + a c f^2 g x +
+ * b^2 e g^2 x - 2 a c e g^2 x - a b f g^2 x + a^2 g^3 x +
+ * 3 b c e^2 h x - 6 a d e^2 h x - 2 b^2 e f h x - a c e f h x +
+ * 2 a b f^2 h x + a b e g h x - 3 a^2 f g h x + 3 a^2 e h^2 x -
+ * 3 d e^3 x^2 + c e^2 f x^2 - b e f^2 x^2 + a f^3 x^2 +
+ * 2 b e^2 g x^2 - 3 a e f g x^2 + 3 a e^2 h x^2 + e^3 x^3 -
+ * c^3 e^2 y + 3 b c d e^2 y - 3 a d^2 e^2 y + b c^2 e f y -
+ * 2 b^2 d e f y - a c d e f y - a c^2 f^2 y + 2 a b d f^2 y -
+ * b^2 c e g y + 2 a c^2 e g y + a b d e g y + a b c f g y -
+ * 3 a^2 d f g y - a^2 c g^2 y + 2 b^3 e h y - 6 a b c e h y +
+ * 6 a^2 d e h y - 2 a b^2 f h y + 4 a^2 c f h y + 2 a^2 b g h y -
+ * 3 a^3 h^2 y - 3 b c e^2 x y + 6 a d e^2 x y + 2 b^2 e f x y +
+ * a c e f x y - 2 a b f^2 x y - a b e g x y + 3 a^2 f g x y -
+ * 6 a^2 e h x y - 3 a e^2 x^2 y - b^3 e y^2 + 3 a b c e y^2 -
+ * 3 a^2 d e y^2 + a b^2 f y^2 - 2 a^2 c f y^2 - a^2 b g y^2 +
* 3 a^3 h y^2 + 3 a^2 e x y^2 - a^3 y^3
*/
@@ -75,7 +75,7 @@
// FIXME: factoring version unwritten
// static bool straight_forward = true;
-/* from CubicParameterizationCode.cpp output:
+/* from CubicParameterizationCode.cpp output:
* double A = e * e * e;
* double B = -3 * a * e * e;
* double C = 3 * a * a * e;
@@ -96,7 +96,7 @@
// start of generated code
static double calc_xx(double a, double b, double c, double d,
double e, double f, double g, double h) {
- return
+ return
-3 * d * e * e * e
+ c * e * e * f
- b * e * f * f
@@ -108,7 +108,7 @@
static double calc_xy(double a, double b, double c, double d,
double e, double f, double g, double h) {
- return
+ return
-3 * b * c * e * e
+ 6 * a * d * e * e
+ 2 * b * b * e * f
@@ -121,7 +121,7 @@
static double calc_yy(double a, double b, double c, double d,
double e, double f, double g, double h) {
- return
+ return
-b * b * b * e
+ 3 * a * b * c * e
- 3 * a * a * d * e
@@ -133,7 +133,7 @@
static double calc_x(double a, double b, double c, double d,
double e, double f, double g, double h) {
- return
+ return
3 * d * d * e * e * e
- 2 * c * d * e * e * f
+ 2 * b * d * e * f * f
@@ -159,7 +159,7 @@
static double calc_y(double a, double b, double c, double d,
double e, double f, double g, double h) {
- return
+ return
-c * c * c * e * e
+ 3 * b * c * d * e * e
- 3 * a * d * d * e * e
@@ -185,7 +185,7 @@
static double calc_c(double a, double b, double c, double d,
double e, double f, double g, double h) {
- return
+ return
-d * d * d * e * e * e
+ c * d * d * e * e * f
- b * d * d * e * f * f
@@ -231,65 +231,65 @@
*/
static double calc_c(double a, double b, double c, double d,
double e, double f, double g, double h) {
- return
-d*d*d*e*e*e - 3*d*d*(3*c*e*e*f + 3*b*e*(-3*f*f + 2*e*g) + a*(9*f*f*f - 9*e*f*g + e*e*h)) -
- h*(27*c*c*c*e*e - 27*c*c*(3*b*e*f - 3*a*f*f + 2*a*e*g) +
- h*(-27*b*b*b*e + 27*a*b*b*f - 9*a*a*b*g + a*a*a*h) +
- 9*c*(9*b*b*e*g + a*b*(-9*f*g + 3*e*h) + a*a*(3*g*g - 2*f*h))) +
- 3*d*(9*c*c*e*e*g + 9*b*b*e*(3*g*g - 2*f*h) + 3*a*b*(-9*f*g*g + 6*f*f*h + e*g*h) +
+ return
+d*d*d*e*e*e - 3*d*d*(3*c*e*e*f + 3*b*e*(-3*f*f + 2*e*g) + a*(9*f*f*f - 9*e*f*g + e*e*h)) -
+ h*(27*c*c*c*e*e - 27*c*c*(3*b*e*f - 3*a*f*f + 2*a*e*g) +
+ h*(-27*b*b*b*e + 27*a*b*b*f - 9*a*a*b*g + a*a*a*h) +
+ 9*c*(9*b*b*e*g + a*b*(-9*f*g + 3*e*h) + a*a*(3*g*g - 2*f*h))) +
+ 3*d*(9*c*c*e*e*g + 9*b*b*e*(3*g*g - 2*f*h) + 3*a*b*(-9*f*g*g + 6*f*f*h + e*g*h) +
a*a*(9*g*g*g - 9*f*g*h + e*h*h) + 3*c*(3*b*e*(-3*f*g + e*h) + a*(9*f*f*g - 6*e*g*g - e*f*h)))
;
}
-// - Power(e - 3*f + 3*g - h,3)*Power(x,3)
+// - Power(e - 3*f + 3*g - h,3)*Power(x,3)
static double calc_xxx(double e3f3gh) {
return -e3f3gh * e3f3gh * e3f3gh;
}
static double calc_y(double a, double b, double c, double d,
double e, double f, double g, double h) {
- return
-+ 3*(6*b*d*d*e*e - d*d*d*e*e + 18*b*b*d*e*f - 18*b*d*d*e*f -
- 9*b*d*d*f*f - 54*b*b*d*e*g + 12*b*d*d*e*g - 27*b*b*d*g*g - 18*b*b*b*e*h + 18*b*b*d*e*h +
- 18*b*b*d*f*h + a*a*a*h*h - 9*b*b*b*h*h + 9*c*c*c*e*(e + 2*h) +
- a*a*(-3*b*h*(2*g + h) + d*(-27*g*g + 9*g*h - h*(2*e + h) + 9*f*(g + h))) +
- a*(9*b*b*h*(2*f + h) - 3*b*d*(6*f*f - 6*f*(3*g - 2*h) + g*(-9*g + h) + e*(g + h)) +
- d*d*(e*e + 9*f*(3*f - g) + e*(-9*f - 9*g + 2*h))) -
- 9*c*c*(d*e*(e + 2*g) + 3*b*(f*h + e*(f + h)) + a*(-3*f*f - 6*f*h + 2*(g*h + e*(g + h)))) +
- 3*c*(d*d*e*(e + 2*f) + a*a*(3*g*g + 6*g*h - 2*h*(2*f + h)) + 9*b*b*(g*h + e*(g + h)) +
- a*d*(-9*f*f - 18*f*g + 6*g*g + f*h + e*(f + 12*g + h)) +
- b*(d*(-3*e*e + 9*f*g + e*(9*f + 9*g - 6*h)) + 3*a*(h*(2*e - 3*g + h) - 3*f*(g + h))))) // *y
+ return
++ 3*(6*b*d*d*e*e - d*d*d*e*e + 18*b*b*d*e*f - 18*b*d*d*e*f -
+ 9*b*d*d*f*f - 54*b*b*d*e*g + 12*b*d*d*e*g - 27*b*b*d*g*g - 18*b*b*b*e*h + 18*b*b*d*e*h +
+ 18*b*b*d*f*h + a*a*a*h*h - 9*b*b*b*h*h + 9*c*c*c*e*(e + 2*h) +
+ a*a*(-3*b*h*(2*g + h) + d*(-27*g*g + 9*g*h - h*(2*e + h) + 9*f*(g + h))) +
+ a*(9*b*b*h*(2*f + h) - 3*b*d*(6*f*f - 6*f*(3*g - 2*h) + g*(-9*g + h) + e*(g + h)) +
+ d*d*(e*e + 9*f*(3*f - g) + e*(-9*f - 9*g + 2*h))) -
+ 9*c*c*(d*e*(e + 2*g) + 3*b*(f*h + e*(f + h)) + a*(-3*f*f - 6*f*h + 2*(g*h + e*(g + h)))) +
+ 3*c*(d*d*e*(e + 2*f) + a*a*(3*g*g + 6*g*h - 2*h*(2*f + h)) + 9*b*b*(g*h + e*(g + h)) +
+ a*d*(-9*f*f - 18*f*g + 6*g*g + f*h + e*(f + 12*g + h)) +
+ b*(d*(-3*e*e + 9*f*g + e*(9*f + 9*g - 6*h)) + 3*a*(h*(2*e - 3*g + h) - 3*f*(g + h))))) // *y
;
}
static double calc_yy(double a, double b, double c, double d,
double e, double f, double g, double h) {
- return
-- 3*(18*c*c*c*e - 18*c*c*d*e + 6*c*d*d*e - d*d*d*e + 3*c*d*d*f - 9*c*c*d*g + a*a*a*h + 9*c*c*c*h -
- 9*b*b*b*(e + 2*h) - a*a*(d*(e - 9*f + 18*g - 7*h) + 3*c*(2*f - 6*g + h)) +
- a*(-9*c*c*(2*e - 6*f + 2*g - h) + d*d*(-7*e + 18*f - 9*g + h) + 3*c*d*(7*e - 17*f + 3*g + h)) +
- 9*b*b*(3*c*(e + g + h) + a*(f + 2*h) - d*(e - 2*(f - 3*g + h))) -
- 3*b*(-(d*d*(e - 6*f + 2*g)) - 3*c*d*(e + 3*f + 3*g - h) + 9*c*c*(e + f + h) + a*a*(g + 2*h) +
- a*(c*(-3*e + 9*f + 9*g + 3*h) + d*(e + 3*f - 17*g + 7*h)))) // *Power(y,2)
+ return
+- 3*(18*c*c*c*e - 18*c*c*d*e + 6*c*d*d*e - d*d*d*e + 3*c*d*d*f - 9*c*c*d*g + a*a*a*h + 9*c*c*c*h -
+ 9*b*b*b*(e + 2*h) - a*a*(d*(e - 9*f + 18*g - 7*h) + 3*c*(2*f - 6*g + h)) +
+ a*(-9*c*c*(2*e - 6*f + 2*g - h) + d*d*(-7*e + 18*f - 9*g + h) + 3*c*d*(7*e - 17*f + 3*g + h)) +
+ 9*b*b*(3*c*(e + g + h) + a*(f + 2*h) - d*(e - 2*(f - 3*g + h))) -
+ 3*b*(-(d*d*(e - 6*f + 2*g)) - 3*c*d*(e + 3*f + 3*g - h) + 9*c*c*(e + f + h) + a*a*(g + 2*h) +
+ a*(c*(-3*e + 9*f + 9*g + 3*h) + d*(e + 3*f - 17*g + 7*h)))) // *Power(y,2)
;
}
-// + Power(a - 3*b + 3*c - d,3)*Power(y,3)
+// + Power(a - 3*b + 3*c - d,3)*Power(y,3)
static double calc_yyy(double a3b3cd) {
return a3b3cd * a3b3cd * a3b3cd;
}
static double calc_xx(double a, double b, double c, double d,
double e, double f, double g, double h) {
- return
+ return
// + Power(x,2)*
-(-3*(-9*b*e*f*f + 9*a*f*f*f + 6*b*e*e*g - 9*a*e*f*g + 27*b*e*f*g - 27*a*f*f*g + 18*a*e*g*g - 54*b*e*g*g +
- 27*a*f*g*g + 27*b*f*g*g - 18*a*g*g*g + a*e*e*h - 9*b*e*e*h + 3*a*e*f*h + 9*b*e*f*h + 9*a*f*f*h -
- 18*b*f*f*h - 21*a*e*g*h + 51*b*e*g*h - 9*a*f*g*h - 27*b*f*g*h + 18*a*g*g*h + 7*a*e*h*h - 18*b*e*h*h - 3*a*f*h*h +
- 18*b*f*h*h - 6*a*g*h*h - 3*b*g*h*h + a*h*h*h +
- 3*c*(-9*f*f*(g - 2*h) + 3*g*g*h - f*h*(9*g + 2*h) + e*e*(f - 6*g + 6*h) +
- e*(9*f*g + 6*g*g - 17*f*h - 3*g*h + 3*h*h)) -
- d*(e*e*e + e*e*(-6*f - 3*g + 7*h) - 9*(2*f - g)*(f*f + g*g - f*(g + h)) +
+(-3*(-9*b*e*f*f + 9*a*f*f*f + 6*b*e*e*g - 9*a*e*f*g + 27*b*e*f*g - 27*a*f*f*g + 18*a*e*g*g - 54*b*e*g*g +
+ 27*a*f*g*g + 27*b*f*g*g - 18*a*g*g*g + a*e*e*h - 9*b*e*e*h + 3*a*e*f*h + 9*b*e*f*h + 9*a*f*f*h -
+ 18*b*f*f*h - 21*a*e*g*h + 51*b*e*g*h - 9*a*f*g*h - 27*b*f*g*h + 18*a*g*g*h + 7*a*e*h*h - 18*b*e*h*h - 3*a*f*h*h +
+ 18*b*f*h*h - 6*a*g*h*h - 3*b*g*h*h + a*h*h*h +
+ 3*c*(-9*f*f*(g - 2*h) + 3*g*g*h - f*h*(9*g + 2*h) + e*e*(f - 6*g + 6*h) +
+ e*(9*f*g + 6*g*g - 17*f*h - 3*g*h + 3*h*h)) -
+ d*(e*e*e + e*e*(-6*f - 3*g + 7*h) - 9*(2*f - g)*(f*f + g*g - f*(g + h)) +
e*(18*f*f + 9*g*g + 3*g*h + h*h - 3*f*(3*g + 7*h)))) )
;
}
@@ -301,35 +301,35 @@
static double calc_x(double a, double b, double c, double d,
double e, double f, double g, double h) {
- return
+ return
// + x*
-(-3*(27*b*b*e*g*g - 27*a*b*f*g*g + 9*a*a*g*g*g - 18*b*b*e*f*h + 18*a*b*f*f*h + 3*a*b*e*g*h -
- 27*b*b*e*g*h - 9*a*a*f*g*h + 27*a*b*f*g*h - 9*a*a*g*g*h + a*a*e*h*h - 9*a*b*e*h*h +
- 27*b*b*e*h*h + 6*a*a*f*h*h - 18*a*b*f*h*h - 9*b*b*f*h*h + 3*a*a*g*h*h +
- 6*a*b*g*h*h - a*a*h*h*h + 9*c*c*(e*e*(g - 3*h) - 3*f*f*h + e*(3*f + 2*g)*h) +
- d*d*(e*e*e - 9*f*f*f + 9*e*f*(f + g) - e*e*(3*f + 6*g + h)) +
- d*(-3*c*(-9*f*f*g + e*e*(2*f - 6*g - 3*h) + e*(9*f*g + 6*g*g + f*h)) +
- a*(-18*f*f*f - 18*e*g*g + 18*g*g*g - 2*e*e*h + 3*e*g*h + 2*e*h*h + 9*f*f*(3*g + 2*h) +
- 3*f*(6*e*g - 9*g*g - e*h - 6*g*h)) - 3*b*(9*f*g*g + e*e*(4*g - 3*h) - 6*f*f*h -
- e*(6*f*f + g*(18*g + h) - 3*f*(3*g + 4*h)))) +
- 3*c*(3*b*(e*e*h + 3*f*g*h - e*(3*f*g - 6*f*h + 6*g*h + h*h)) +
+(-3*(27*b*b*e*g*g - 27*a*b*f*g*g + 9*a*a*g*g*g - 18*b*b*e*f*h + 18*a*b*f*f*h + 3*a*b*e*g*h -
+ 27*b*b*e*g*h - 9*a*a*f*g*h + 27*a*b*f*g*h - 9*a*a*g*g*h + a*a*e*h*h - 9*a*b*e*h*h +
+ 27*b*b*e*h*h + 6*a*a*f*h*h - 18*a*b*f*h*h - 9*b*b*f*h*h + 3*a*a*g*h*h +
+ 6*a*b*g*h*h - a*a*h*h*h + 9*c*c*(e*e*(g - 3*h) - 3*f*f*h + e*(3*f + 2*g)*h) +
+ d*d*(e*e*e - 9*f*f*f + 9*e*f*(f + g) - e*e*(3*f + 6*g + h)) +
+ d*(-3*c*(-9*f*f*g + e*e*(2*f - 6*g - 3*h) + e*(9*f*g + 6*g*g + f*h)) +
+ a*(-18*f*f*f - 18*e*g*g + 18*g*g*g - 2*e*e*h + 3*e*g*h + 2*e*h*h + 9*f*f*(3*g + 2*h) +
+ 3*f*(6*e*g - 9*g*g - e*h - 6*g*h)) - 3*b*(9*f*g*g + e*e*(4*g - 3*h) - 6*f*f*h -
+ e*(6*f*f + g*(18*g + h) - 3*f*(3*g + 4*h)))) +
+ 3*c*(3*b*(e*e*h + 3*f*g*h - e*(3*f*g - 6*f*h + 6*g*h + h*h)) +
a*(9*f*f*(g - 2*h) + f*h*(-e + 9*g + 4*h) - 3*(2*g*g*h + e*(2*g*g - 4*g*h + h*h))))) )
;
}
-
+
static double calc_xy(double a, double b, double c, double d,
double e, double f, double g, double h) {
- return
+ return
// + x*3*
-(-2*a*d*e*e - 7*d*d*e*e + 15*a*d*e*f + 21*d*d*e*f - 9*a*d*f*f - 18*d*d*f*f - 15*a*d*e*g -
- 3*d*d*e*g - 9*a*a*f*g + 9*d*d*f*g + 18*a*a*g*g + 9*a*d*g*g + 2*a*a*e*h - 2*d*d*e*h +
- 3*a*a*f*h + 15*a*d*f*h - 21*a*a*g*h - 15*a*d*g*h + 7*a*a*h*h + 2*a*d*h*h -
- 9*c*c*(2*e*e + 3*f*f + 3*f*h - 2*g*h + e*(-3*f - 4*g + h)) +
- 9*b*b*(3*g*g - 3*g*h + 2*h*(-2*f + h) + e*(-2*f + 3*g + h)) +
- 3*b*(3*c*(e*e + 3*e*(f - 3*g) + (9*f - 3*g - h)*h) + a*(6*f*f + e*g - 9*f*g - 9*g*g - 5*e*h + 9*f*h + 14*g*h - 7*h*h) +
- d*(-e*e + 12*f*f - 27*f*g + e*(-9*f + 20*g - 5*h) + g*(9*g + h))) +
- 3*c*(a*(-(e*f) - 9*f*f + 27*f*g - 12*g*g + 5*e*h - 20*f*h + 9*g*h + h*h) +
- d*(7*e*e + 9*f*f + 9*f*g - 6*g*g - f*h + e*(-14*f - 9*g + 5*h)))) // *y
+(-2*a*d*e*e - 7*d*d*e*e + 15*a*d*e*f + 21*d*d*e*f - 9*a*d*f*f - 18*d*d*f*f - 15*a*d*e*g -
+ 3*d*d*e*g - 9*a*a*f*g + 9*d*d*f*g + 18*a*a*g*g + 9*a*d*g*g + 2*a*a*e*h - 2*d*d*e*h +
+ 3*a*a*f*h + 15*a*d*f*h - 21*a*a*g*h - 15*a*d*g*h + 7*a*a*h*h + 2*a*d*h*h -
+ 9*c*c*(2*e*e + 3*f*f + 3*f*h - 2*g*h + e*(-3*f - 4*g + h)) +
+ 9*b*b*(3*g*g - 3*g*h + 2*h*(-2*f + h) + e*(-2*f + 3*g + h)) +
+ 3*b*(3*c*(e*e + 3*e*(f - 3*g) + (9*f - 3*g - h)*h) + a*(6*f*f + e*g - 9*f*g - 9*g*g - 5*e*h + 9*f*h + 14*g*h - 7*h*h) +
+ d*(-e*e + 12*f*f - 27*f*g + e*(-9*f + 20*g - 5*h) + g*(9*g + h))) +
+ 3*c*(a*(-(e*f) - 9*f*f + 27*f*g - 12*g*g + 5*e*h - 20*f*h + 9*g*h + h*h) +
+ d*(7*e*e + 9*f*f + 9*f*g - 6*g*g - f*h + e*(-14*f - 9*g + 5*h)))) // *y
;
}
@@ -358,7 +358,7 @@
c = 3*C - 3*D
d = D
*/
-
+
/* http://www.algorithmist.net/bezier3.html
p = 3 * A
q = 3 * B
@@ -369,9 +369,9 @@
d = D - A + q - r
B(t) = a + t * (b + t * (c + t * d))
-
+
so
-
+
B(t) = a + t*b + t*t*(c + t*d)
= a + t*b + t*t*c + t*t*t*d
*/
diff --git a/experimental/Intersection/CubicParameterizationCode.cpp b/experimental/Intersection/CubicParameterizationCode.cpp
index 15767dd..3fe0492 100644
--- a/experimental/Intersection/CubicParameterizationCode.cpp
+++ b/experimental/Intersection/CubicParameterizationCode.cpp
@@ -73,80 +73,80 @@
const size_t len2 = sizeof(result2) - 1;
/* Given: r1 = Resultant[
- * a*(1 - t)^3 + 3*b*(1 - t)^2*t + 3*c*(1 - t)*t^2 + d*t^3 - x,
+ * a*(1 - t)^3 + 3*b*(1 - t)^2*t + 3*c*(1 - t)*t^2 + d*t^3 - x,
* e*(1 - t)^3 + 3*f*(1 - t)^2*t + 3*g*(1 - t)*t^2 + h*t^3 - y, t]
* Collect[r1, {x, y}, Simplify]
* CForm[%]
* then use regex to replace Power\(([a-h]),3\) with \1*\1*\1
* and Power\(([a-h]),2\) with \1*\1
* yields:
-
-d*d*d*e*e*e - 3*d*d*(3*c*e*e*f + 3*b*e*(-3*f*f + 2*e*g) + a*(9*f*f*f - 9*e*f*g + e*e*h)) -
- h*(27*c*c*c*e*e - 27*c*c*(3*b*e*f - 3*a*f*f + 2*a*e*g) +
- h*(-27*b*b*b*e + 27*a*b*b*f - 9*a*a*b*g + a*a*a*h) +
- 9*c*(9*b*b*e*g + a*b*(-9*f*g + 3*e*h) + a*a*(3*g*g - 2*f*h))) +
- 3*d*(9*c*c*e*e*g + 9*b*b*e*(3*g*g - 2*f*h) + 3*a*b*(-9*f*g*g + 6*f*f*h + e*g*h) +
+
+d*d*d*e*e*e - 3*d*d*(3*c*e*e*f + 3*b*e*(-3*f*f + 2*e*g) + a*(9*f*f*f - 9*e*f*g + e*e*h)) -
+ h*(27*c*c*c*e*e - 27*c*c*(3*b*e*f - 3*a*f*f + 2*a*e*g) +
+ h*(-27*b*b*b*e + 27*a*b*b*f - 9*a*a*b*g + a*a*a*h) +
+ 9*c*(9*b*b*e*g + a*b*(-9*f*g + 3*e*h) + a*a*(3*g*g - 2*f*h))) +
+ 3*d*(9*c*c*e*e*g + 9*b*b*e*(3*g*g - 2*f*h) + 3*a*b*(-9*f*g*g + 6*f*f*h + e*g*h) +
a*a*(9*g*g*g - 9*f*g*h + e*h*h) + 3*c*(3*b*e*(-3*f*g + e*h) + a*(9*f*f*g - 6*e*g*g - e*f*h)))
-
-- Power(e - 3*f + 3*g - h,3)*Power(x,3)
-
-+ 3*(6*b*d*d*e*e - d*d*d*e*e + 18*b*b*d*e*f - 18*b*d*d*e*f -
- 9*b*d*d*f*f - 54*b*b*d*e*g + 12*b*d*d*e*g - 27*b*b*d*g*g - 18*b*b*b*e*h + 18*b*b*d*e*h +
- 18*b*b*d*f*h + a*a*a*h*h - 9*b*b*b*h*h + 9*c*c*c*e*(e + 2*h) +
- a*a*(-3*b*h*(2*g + h) + d*(-27*g*g + 9*g*h - h*(2*e + h) + 9*f*(g + h))) +
- a*(9*b*b*h*(2*f + h) - 3*b*d*(6*f*f - 6*f*(3*g - 2*h) + g*(-9*g + h) + e*(g + h)) +
- d*d*(e*e + 9*f*(3*f - g) + e*(-9*f - 9*g + 2*h))) -
- 9*c*c*(d*e*(e + 2*g) + 3*b*(f*h + e*(f + h)) + a*(-3*f*f - 6*f*h + 2*(g*h + e*(g + h)))) +
- 3*c*(d*d*e*(e + 2*f) + a*a*(3*g*g + 6*g*h - 2*h*(2*f + h)) + 9*b*b*(g*h + e*(g + h)) +
- a*d*(-9*f*f - 18*f*g + 6*g*g + f*h + e*(f + 12*g + h)) +
- b*(d*(-3*e*e + 9*f*g + e*(9*f + 9*g - 6*h)) + 3*a*(h*(2*e - 3*g + h) - 3*f*(g + h)))))*y
-
-- 3*(18*c*c*c*e - 18*c*c*d*e + 6*c*d*d*e - d*d*d*e + 3*c*d*d*f - 9*c*c*d*g + a*a*a*h + 9*c*c*c*h -
- 9*b*b*b*(e + 2*h) - a*a*(d*(e - 9*f + 18*g - 7*h) + 3*c*(2*f - 6*g + h)) +
- a*(-9*c*c*(2*e - 6*f + 2*g - h) + d*d*(-7*e + 18*f - 9*g + h) + 3*c*d*(7*e - 17*f + 3*g + h)) +
- 9*b*b*(3*c*(e + g + h) + a*(f + 2*h) - d*(e - 2*(f - 3*g + h))) -
- 3*b*(-(d*d*(e - 6*f + 2*g)) - 3*c*d*(e + 3*f + 3*g - h) + 9*c*c*(e + f + h) + a*a*(g + 2*h) +
- a*(c*(-3*e + 9*f + 9*g + 3*h) + d*(e + 3*f - 17*g + 7*h))))*Power(y,2)
-
-+ Power(a - 3*b + 3*c - d,3)*Power(y,3)
-
-+ Power(x,2)*(-3*(-9*b*e*f*f + 9*a*f*f*f + 6*b*e*e*g - 9*a*e*f*g + 27*b*e*f*g - 27*a*f*f*g + 18*a*e*g*g - 54*b*e*g*g +
- 27*a*f*g*g + 27*b*f*g*g - 18*a*g*g*g + a*e*e*h - 9*b*e*e*h + 3*a*e*f*h + 9*b*e*f*h + 9*a*f*f*h -
- 18*b*f*f*h - 21*a*e*g*h + 51*b*e*g*h - 9*a*f*g*h - 27*b*f*g*h + 18*a*g*g*h + 7*a*e*h*h - 18*b*e*h*h - 3*a*f*h*h +
- 18*b*f*h*h - 6*a*g*h*h - 3*b*g*h*h + a*h*h*h +
- 3*c*(-9*f*f*(g - 2*h) + 3*g*g*h - f*h*(9*g + 2*h) + e*e*(f - 6*g + 6*h) +
- e*(9*f*g + 6*g*g - 17*f*h - 3*g*h + 3*h*h)) -
- d*(e*e*e + e*e*(-6*f - 3*g + 7*h) - 9*(2*f - g)*(f*f + g*g - f*(g + h)) +
+
+- Power(e - 3*f + 3*g - h,3)*Power(x,3)
+
++ 3*(6*b*d*d*e*e - d*d*d*e*e + 18*b*b*d*e*f - 18*b*d*d*e*f -
+ 9*b*d*d*f*f - 54*b*b*d*e*g + 12*b*d*d*e*g - 27*b*b*d*g*g - 18*b*b*b*e*h + 18*b*b*d*e*h +
+ 18*b*b*d*f*h + a*a*a*h*h - 9*b*b*b*h*h + 9*c*c*c*e*(e + 2*h) +
+ a*a*(-3*b*h*(2*g + h) + d*(-27*g*g + 9*g*h - h*(2*e + h) + 9*f*(g + h))) +
+ a*(9*b*b*h*(2*f + h) - 3*b*d*(6*f*f - 6*f*(3*g - 2*h) + g*(-9*g + h) + e*(g + h)) +
+ d*d*(e*e + 9*f*(3*f - g) + e*(-9*f - 9*g + 2*h))) -
+ 9*c*c*(d*e*(e + 2*g) + 3*b*(f*h + e*(f + h)) + a*(-3*f*f - 6*f*h + 2*(g*h + e*(g + h)))) +
+ 3*c*(d*d*e*(e + 2*f) + a*a*(3*g*g + 6*g*h - 2*h*(2*f + h)) + 9*b*b*(g*h + e*(g + h)) +
+ a*d*(-9*f*f - 18*f*g + 6*g*g + f*h + e*(f + 12*g + h)) +
+ b*(d*(-3*e*e + 9*f*g + e*(9*f + 9*g - 6*h)) + 3*a*(h*(2*e - 3*g + h) - 3*f*(g + h)))))*y
+
+- 3*(18*c*c*c*e - 18*c*c*d*e + 6*c*d*d*e - d*d*d*e + 3*c*d*d*f - 9*c*c*d*g + a*a*a*h + 9*c*c*c*h -
+ 9*b*b*b*(e + 2*h) - a*a*(d*(e - 9*f + 18*g - 7*h) + 3*c*(2*f - 6*g + h)) +
+ a*(-9*c*c*(2*e - 6*f + 2*g - h) + d*d*(-7*e + 18*f - 9*g + h) + 3*c*d*(7*e - 17*f + 3*g + h)) +
+ 9*b*b*(3*c*(e + g + h) + a*(f + 2*h) - d*(e - 2*(f - 3*g + h))) -
+ 3*b*(-(d*d*(e - 6*f + 2*g)) - 3*c*d*(e + 3*f + 3*g - h) + 9*c*c*(e + f + h) + a*a*(g + 2*h) +
+ a*(c*(-3*e + 9*f + 9*g + 3*h) + d*(e + 3*f - 17*g + 7*h))))*Power(y,2)
+
++ Power(a - 3*b + 3*c - d,3)*Power(y,3)
+
++ Power(x,2)*(-3*(-9*b*e*f*f + 9*a*f*f*f + 6*b*e*e*g - 9*a*e*f*g + 27*b*e*f*g - 27*a*f*f*g + 18*a*e*g*g - 54*b*e*g*g +
+ 27*a*f*g*g + 27*b*f*g*g - 18*a*g*g*g + a*e*e*h - 9*b*e*e*h + 3*a*e*f*h + 9*b*e*f*h + 9*a*f*f*h -
+ 18*b*f*f*h - 21*a*e*g*h + 51*b*e*g*h - 9*a*f*g*h - 27*b*f*g*h + 18*a*g*g*h + 7*a*e*h*h - 18*b*e*h*h - 3*a*f*h*h +
+ 18*b*f*h*h - 6*a*g*h*h - 3*b*g*h*h + a*h*h*h +
+ 3*c*(-9*f*f*(g - 2*h) + 3*g*g*h - f*h*(9*g + 2*h) + e*e*(f - 6*g + 6*h) +
+ e*(9*f*g + 6*g*g - 17*f*h - 3*g*h + 3*h*h)) -
+ d*(e*e*e + e*e*(-6*f - 3*g + 7*h) - 9*(2*f - g)*(f*f + g*g - f*(g + h)) +
e*(18*f*f + 9*g*g + 3*g*h + h*h - 3*f*(3*g + 7*h)))) )
-
+
+ Power(x,2)*(3*(a - 3*b + 3*c - d)*Power(e - 3*f + 3*g - h,2)*y)
-
-+ x*(-3*(27*b*b*e*g*g - 27*a*b*f*g*g + 9*a*a*g*g*g - 18*b*b*e*f*h + 18*a*b*f*f*h + 3*a*b*e*g*h -
- 27*b*b*e*g*h - 9*a*a*f*g*h + 27*a*b*f*g*h - 9*a*a*g*g*h + a*a*e*h*h - 9*a*b*e*h*h +
- 27*b*b*e*h*h + 6*a*a*f*h*h - 18*a*b*f*h*h - 9*b*b*f*h*h + 3*a*a*g*h*h +
- 6*a*b*g*h*h - a*a*h*h*h + 9*c*c*(e*e*(g - 3*h) - 3*f*f*h + e*(3*f + 2*g)*h) +
- d*d*(e*e*e - 9*f*f*f + 9*e*f*(f + g) - e*e*(3*f + 6*g + h)) +
- d*(-3*c*(-9*f*f*g + e*e*(2*f - 6*g - 3*h) + e*(9*f*g + 6*g*g + f*h)) +
- a*(-18*f*f*f - 18*e*g*g + 18*g*g*g - 2*e*e*h + 3*e*g*h + 2*e*h*h + 9*f*f*(3*g + 2*h) +
- 3*f*(6*e*g - 9*g*g - e*h - 6*g*h)) - 3*b*(9*f*g*g + e*e*(4*g - 3*h) - 6*f*f*h -
- e*(6*f*f + g*(18*g + h) - 3*f*(3*g + 4*h)))) +
- 3*c*(3*b*(e*e*h + 3*f*g*h - e*(3*f*g - 6*f*h + 6*g*h + h*h)) +
+
++ x*(-3*(27*b*b*e*g*g - 27*a*b*f*g*g + 9*a*a*g*g*g - 18*b*b*e*f*h + 18*a*b*f*f*h + 3*a*b*e*g*h -
+ 27*b*b*e*g*h - 9*a*a*f*g*h + 27*a*b*f*g*h - 9*a*a*g*g*h + a*a*e*h*h - 9*a*b*e*h*h +
+ 27*b*b*e*h*h + 6*a*a*f*h*h - 18*a*b*f*h*h - 9*b*b*f*h*h + 3*a*a*g*h*h +
+ 6*a*b*g*h*h - a*a*h*h*h + 9*c*c*(e*e*(g - 3*h) - 3*f*f*h + e*(3*f + 2*g)*h) +
+ d*d*(e*e*e - 9*f*f*f + 9*e*f*(f + g) - e*e*(3*f + 6*g + h)) +
+ d*(-3*c*(-9*f*f*g + e*e*(2*f - 6*g - 3*h) + e*(9*f*g + 6*g*g + f*h)) +
+ a*(-18*f*f*f - 18*e*g*g + 18*g*g*g - 2*e*e*h + 3*e*g*h + 2*e*h*h + 9*f*f*(3*g + 2*h) +
+ 3*f*(6*e*g - 9*g*g - e*h - 6*g*h)) - 3*b*(9*f*g*g + e*e*(4*g - 3*h) - 6*f*f*h -
+ e*(6*f*f + g*(18*g + h) - 3*f*(3*g + 4*h)))) +
+ 3*c*(3*b*(e*e*h + 3*f*g*h - e*(3*f*g - 6*f*h + 6*g*h + h*h)) +
a*(9*f*f*(g - 2*h) + f*h*(-e + 9*g + 4*h) - 3*(2*g*g*h + e*(2*g*g - 4*g*h + h*h))))) )
-
-+ x*3*(-2*a*d*e*e - 7*d*d*e*e + 15*a*d*e*f + 21*d*d*e*f - 9*a*d*f*f - 18*d*d*f*f - 15*a*d*e*g -
- 3*d*d*e*g - 9*a*a*f*g + 9*d*d*f*g + 18*a*a*g*g + 9*a*d*g*g + 2*a*a*e*h - 2*d*d*e*h +
- 3*a*a*f*h + 15*a*d*f*h - 21*a*a*g*h - 15*a*d*g*h + 7*a*a*h*h + 2*a*d*h*h -
- 9*c*c*(2*e*e + 3*f*f + 3*f*h - 2*g*h + e*(-3*f - 4*g + h)) +
- 9*b*b*(3*g*g - 3*g*h + 2*h*(-2*f + h) + e*(-2*f + 3*g + h)) +
- 3*b*(3*c*(e*e + 3*e*(f - 3*g) + (9*f - 3*g - h)*h) + a*(6*f*f + e*g - 9*f*g - 9*g*g - 5*e*h + 9*f*h + 14*g*h - 7*h*h) +
- d*(-e*e + 12*f*f - 27*f*g + e*(-9*f + 20*g - 5*h) + g*(9*g + h))) +
- 3*c*(a*(-(e*f) - 9*f*f + 27*f*g - 12*g*g + 5*e*h - 20*f*h + 9*g*h + h*h) +
- d*(7*e*e + 9*f*f + 9*f*g - 6*g*g - f*h + e*(-14*f - 9*g + 5*h))))*y
-
+
++ x*3*(-2*a*d*e*e - 7*d*d*e*e + 15*a*d*e*f + 21*d*d*e*f - 9*a*d*f*f - 18*d*d*f*f - 15*a*d*e*g -
+ 3*d*d*e*g - 9*a*a*f*g + 9*d*d*f*g + 18*a*a*g*g + 9*a*d*g*g + 2*a*a*e*h - 2*d*d*e*h +
+ 3*a*a*f*h + 15*a*d*f*h - 21*a*a*g*h - 15*a*d*g*h + 7*a*a*h*h + 2*a*d*h*h -
+ 9*c*c*(2*e*e + 3*f*f + 3*f*h - 2*g*h + e*(-3*f - 4*g + h)) +
+ 9*b*b*(3*g*g - 3*g*h + 2*h*(-2*f + h) + e*(-2*f + 3*g + h)) +
+ 3*b*(3*c*(e*e + 3*e*(f - 3*g) + (9*f - 3*g - h)*h) + a*(6*f*f + e*g - 9*f*g - 9*g*g - 5*e*h + 9*f*h + 14*g*h - 7*h*h) +
+ d*(-e*e + 12*f*f - 27*f*g + e*(-9*f + 20*g - 5*h) + g*(9*g + h))) +
+ 3*c*(a*(-(e*f) - 9*f*f + 27*f*g - 12*g*g + 5*e*h - 20*f*h + 9*g*h + h*h) +
+ d*(7*e*e + 9*f*f + 9*f*g - 6*g*g - f*h + e*(-14*f - 9*g + 5*h))))*y
+
- x*3*Power(a - 3*b + 3*c - d,2)*(e - 3*f + 3*g - h)*Power(y,2)
-
+
*/
-
+
const int factors = 8;
struct coeff {
@@ -276,7 +276,7 @@
"\n ", 'A' + (it - c.begin()));
if (co[0].s > 0) {
printf(" ");
- }
+ }
if (abs(co[0].s) == 1) {
printf(" ");
}
diff --git a/experimental/Intersection/CubicParameterization_Test.cpp b/experimental/Intersection/CubicParameterization_Test.cpp
index 716aaec..2139f3b 100644
--- a/experimental/Intersection/CubicParameterization_Test.cpp
+++ b/experimental/Intersection/CubicParameterization_Test.cpp
@@ -91,7 +91,7 @@
for (size_t index = firstCubicParameterizationTest; index < cubics_count; ++index) {
for (size_t inner = 0; inner < 4; inner += 3) {
if (!point_on_parameterized_curve(cubics[index], cubics[index][inner])) {
- printf("%s [%zu,%zu] 1 parameterization failed\n",
+ printf("%s [%zu,%zu] 1 parameterization failed\n",
__FUNCTION__, index, inner);
}
if (!point_on_parameterized_curve(cubics[index], cubics[index ^ 1][inner])) {
diff --git a/experimental/Intersection/CubicReduceOrder.cpp b/experimental/Intersection/CubicReduceOrder.cpp
index 84f2079..b9c3c59 100644
--- a/experimental/Intersection/CubicReduceOrder.cpp
+++ b/experimental/Intersection/CubicReduceOrder.cpp
@@ -30,7 +30,7 @@
if (reduction[smaller].y > yExtrema) {
reduction[smaller].y = yExtrema;
continue;
- }
+ }
if (reduction[larger].y < yExtrema) {
reduction[larger].y = yExtrema;
}
@@ -50,7 +50,7 @@
if (reduction[smaller].x > xExtrema) {
reduction[smaller].x = xExtrema;
continue;
- }
+ }
if (reduction[larger].x < xExtrema) {
reduction[larger].x = xExtrema;
}
@@ -183,7 +183,7 @@
// reduce to a quadratic or smaller
// look for identical points
-// look for all four points in a line
+// look for all four points in a line
// note that three points in a line doesn't simplify a cubic
// look for approximation with single quadratic
// save approximation with multiple quadratics for later
diff --git a/experimental/Intersection/CubicReduceOrder_Test.cpp b/experimental/Intersection/CubicReduceOrder_Test.cpp
index 98662e2..4a8e622 100644
--- a/experimental/Intersection/CubicReduceOrder_Test.cpp
+++ b/experimental/Intersection/CubicReduceOrder_Test.cpp
@@ -37,7 +37,7 @@
int firstQuadraticLineTest = run == RunAll ? 0 : run == RunQuadraticLines ? firstTestIndex : INT_MAX;
int firstQuadraticModLineTest = run == RunAll ? 0 : run == RunQuadraticModLines ? firstTestIndex : INT_MAX;
int firstComputedLinesTest = run == RunAll ? 0 : run == RunComputedLines ? firstTestIndex : INT_MAX;
-
+
for (index = firstPointDegeneratesTest; index < pointDegenerates_count; ++index) {
const Cubic& cubic = pointDegenerates[index];
order = reduceOrder(cubic, reduce, kReduceOrder_QuadraticsAllowed);
@@ -105,11 +105,11 @@
printf("[%d] line mod quad order=%d\n", (int) index, order);
}
}
-
+
// test if computed line end points are valid
for (index = firstComputedLinesTest; index < lines_count; ++index) {
const Cubic& cubic = lines[index];
- bool controlsInside = controls_inside(cubic);
+ bool controlsInside = controls_inside(cubic);
order = reduceOrder(cubic, reduce, kReduceOrder_QuadraticsAllowed);
if (reduce[0].x == reduce[1].x && reduce[0].y == reduce[1].y) {
printf("[%d] line computed ends match order=%d\n", (int) index, order);
@@ -132,7 +132,7 @@
|| !approximately_equal(reduce[1].y, bounds.top) && !approximately_equal(reduce[1].y, bounds.bottom)) {
printf("[%d] line computed tight bounds order=%d\n", (int) index, order);
}
-
+
}
}
}
diff --git a/experimental/Intersection/CubicSubDivide.cpp b/experimental/Intersection/CubicSubDivide.cpp
index 0c6ed42..98250ad 100644
--- a/experimental/Intersection/CubicSubDivide.cpp
+++ b/experimental/Intersection/CubicSubDivide.cpp
@@ -3,21 +3,21 @@
/*
Given a cubic c, t1, and t2, find a small cubic segment.
-
+
The new cubic is defined as points A, B, C, and D, where
s1 = 1 - t1
s2 = 1 - t2
A = c[0]*s1*s1*s1 + 3*c[1]*s1*s1*t1 + 3*c[2]*s1*t1*t1 + c[3]*t1*t1*t1
D = c[0]*s2*s2*s2 + 3*c[1]*s2*s2*t2 + 3*c[2]*s2*t2*t2 + c[3]*t2*t2*t2
-
+
We don't have B or C. So We define two equations to isolate them.
First, compute two reference T values 1/3 and 2/3 from t1 to t2:
-
+
c(at (2*t1 + t2)/3) == E
c(at (t1 + 2*t2)/3) == F
-
+
Next, compute where those values must be if we know the values of B and C:
-
+
_12 = A*2/3 + B*1/3
12_ = A*1/3 + B*2/3
_23 = B*2/3 + C*1/3
@@ -36,9 +36,9 @@
= F
E*27 = A*8 + B*12 + C*6 + D
F*27 = A + B*6 + C*12 + D*8
-
+
Group the known values on one side:
-
+
M = E*27 - A*8 - D = B*12 + C* 6
N = F*27 - A - D*8 = B* 6 + C*12
M*2 - N = B*18
@@ -46,7 +46,7 @@
B = (M*2 - N)/18
C = (N*2 - M)/18
*/
-
+
static double interp_cubic_coords(const double* src, double t)
{
double ab = interp(src[0], src[2], t);
@@ -57,7 +57,7 @@
double abcd = interp(abc, bcd, t);
return abcd;
}
-
+
void sub_divide(const Cubic& src, double t1, double t2, Cubic& dst) {
double ax = dst[0].x = interp_cubic_coords(&src[0].x, t1);
double ay = dst[0].y = interp_cubic_coords(&src[0].y, t1);
diff --git a/experimental/Intersection/DataTypes.cpp b/experimental/Intersection/DataTypes.cpp
index db153f6..546665c 100644
--- a/experimental/Intersection/DataTypes.cpp
+++ b/experimental/Intersection/DataTypes.cpp
@@ -7,7 +7,7 @@
extern "C" {
#endif
-void *memcpy(void *, const void *, size_t);
+void *memcpy(void *, const void *, size_t);
#ifdef __cplusplus
}
@@ -29,7 +29,7 @@
bool Negative() const { return (i >> 31) != 0; }
int32_t RawMantissa() const { return i & ((1 << 23) - 1); }
int32_t RawExponent() const { return (i >> 23) & 0xFF; }
-
+
int32_t i;
float f;
#ifdef _DEBUG
@@ -41,25 +41,25 @@
} parts;
#endif
};
-
+
bool AlmostEqualUlps(float A, float B, int maxUlpsDiff)
{
Float_t uA(A);
Float_t uB(B);
-
+
// Different signs means they do not match.
if (uA.Negative() != uB.Negative())
{
// Check for equality to make sure +0==-0
return A == B;
}
-
+
// Find the difference in ULPs.
int ulpsDiff = abs(uA.i - uB.i);
return ulpsDiff <= maxUlpsDiff;
}
-int UlpsDiff(float A, float B)
+int UlpsDiff(float A, float B)
{
Float_t uA(A);
Float_t uB(B);
diff --git a/experimental/Intersection/DataTypes.h b/experimental/Intersection/DataTypes.h
index c06e6ee..8c924af 100644
--- a/experimental/Intersection/DataTypes.h
+++ b/experimental/Intersection/DataTypes.h
@@ -59,7 +59,7 @@
#endif
inline bool approximately_zero(double x) {
-
+
return fabs(x) < FLT_EPSILON;
}
@@ -121,7 +121,7 @@
friend bool operator!=(const _Point& a, const _Point& b) {
return a.x!= b.x || a.y != b.y;
}
-
+
bool approximatelyEqual(const _Point& a) const {
return approximately_equal(a.y, y) && approximately_equal(a.x, x);
}
@@ -137,7 +137,7 @@
double top;
double right;
double bottom;
-
+
void add(const _Point& pt) {
if (left > pt.x) {
left = pt.x;
@@ -152,17 +152,17 @@
bottom = pt.y;
}
}
-
+
void set(const _Point& pt) {
left = right = pt.x;
top = bottom = pt.y;
}
-
+
void setBounds(const _Line& line) {
set(line[0]);
add(line[1]);
}
-
+
void setBounds(const Cubic& );
void setBounds(const Quadratic& );
void setRawBounds(const Cubic& );
diff --git a/experimental/Intersection/EdgeDemo.cpp b/experimental/Intersection/EdgeDemo.cpp
index 21eefee..33aae21 100644
--- a/experimental/Intersection/EdgeDemo.cpp
+++ b/experimental/Intersection/EdgeDemo.cpp
@@ -68,7 +68,7 @@
return true;
}
-static void createStar(SkPath& path, SkScalar innerRadius, SkScalar outerRadius,
+static void createStar(SkPath& path, SkScalar innerRadius, SkScalar outerRadius,
SkScalar startAngle, int points, SkPoint center) {
SkScalar angle = startAngle;
for (int index = 0; index < points * 2; ++index) {
diff --git a/experimental/Intersection/EdgeWalker.cpp b/experimental/Intersection/EdgeWalker.cpp
index 4442e92..47bd037 100644
--- a/experimental/Intersection/EdgeWalker.cpp
+++ b/experimental/Intersection/EdgeWalker.cpp
@@ -275,10 +275,10 @@
sort
active T
-if a contour's bounds is outside of the active area, no need to create edges
+if a contour's bounds is outside of the active area, no need to create edges
*/
-/* given one or more paths,
+/* given one or more paths,
find the bounds of each contour, select the active contours
for each active contour, compute a set of edges
each edge corresponds to one or more lines and curves
@@ -303,7 +303,7 @@
bounds.set(pts[0].fX, pts[0].fY, pts[0].fX, pts[0].fY);
count = 0;
break;
- case SkPath::kLine_Verb:
+ case SkPath::kLine_Verb:
count = 1;
break;
case SkPath::kQuad_Verb:
@@ -611,7 +611,7 @@
one, two, endPt1.fX < endPt2.fX ? "true" : "false");
#endif
return endPt1.fX < endPt2.fX;
- }
+ }
SkScalar dx1y2 = (startPt1.fX - endPt1.fX) * dy2;
SkScalar dx2y1 = (startPt2.fX - endPt2.fX) * dy1;
#if DEBUG_OUT_LESS_THAN
@@ -708,7 +708,7 @@
for (index = 0; index < count; ++index) {
const OutEdge& edge = fEdges[index];
uint8_t verb = edge.fVerb;
- SkDebugf("%s %d edge=%d %s (%1.9g,%1.9g) (%1.9g,%1.9g)\n",
+ SkDebugf("%s %d edge=%d %s (%1.9g,%1.9g) (%1.9g,%1.9g)\n",
index == 0 ? __FUNCTION__ : " ",
index + 1, edge.fID, kLVerbStr[verb], edge.fPts[0].fX,
edge.fPts[0].fY, edge.fPts[verb].fX, edge.fPts[verb].fY);
@@ -754,7 +754,7 @@
, fBottomIntercepts(0)
, fExplicit(false) {
}
-
+
Intercepts& operator=(const Intercepts& src) {
fTs = src.fTs;
fTopIntercepts = src.fTopIntercepts;
@@ -808,7 +808,7 @@
unsigned char fTopIntercepts; // 0=init state 1=1 edge >1=multiple edges
unsigned char fBottomIntercepts;
bool fExplicit; // if set, suppress 0 and 1
-
+
};
struct HorizontalEdge {
@@ -842,7 +842,7 @@
// Avoid collapsing t values that are close to the same since
// we walk ts to describe consecutive intersections. Since a pair of ts can
// be nearly equal, any problems caused by this should be taken care
- // of later.
+ // of later.
int add(double* ts, size_t count, ptrdiff_t verbIndex) {
// FIXME: in the pathological case where there is a ton of intercepts, binary search?
bool foundIntercept = false;
@@ -885,7 +885,7 @@
fContainsIntercepts |= foundIntercept;
return insertedAt;
}
-
+
void addPartial(SkTArray<InEdge>& edges, int ptStart, int ptEnd,
int verbStart, int verbEnd) {
InEdge* edge = edges.push_back_n(1);
@@ -954,7 +954,7 @@
}
fContainsIntercepts = fIntersected = false;
}
-
+
void flip() {
size_t index;
size_t last = fPts.count() - 1;
@@ -966,7 +966,7 @@
SkTSwap<uint8_t>(fVerbs[index], fVerbs[last]);
}
}
-
+
void flipTs() {
SkASSERT(fIntercepts.count() == 1);
Intercepts& intercepts = fIntercepts[0];
@@ -1006,7 +1006,7 @@
++ptPtr;
}
}
-
+
// recompute bounds based on subrange of T values
void setSubBounds() {
SkASSERT(fIntercepts.count() == 1);
@@ -1078,7 +1078,7 @@
__FUNCTION__, lastSplit, firstSplit);
#endif
}
- addSplit(edges, pts, verb, intercepts,
+ addSplit(edges, pts, verb, intercepts,
firstSplit, tIndex, true);
#if DEBUG_SPLIT
SkDebugf("%s addSplit 2 tIndex=%d,%d flip\n",
@@ -1180,7 +1180,7 @@
public:
InEdgeBuilder(const SkPath& path, bool ignoreHorizontal, SkTArray<InEdge>& edges,
- SkTDArray<HorizontalEdge>& horizontalEdges)
+ SkTDArray<HorizontalEdge>& horizontalEdges)
: fPath(path)
, fCurrentEdge(NULL)
, fEdges(edges)
@@ -1332,7 +1332,7 @@
fPts += *fVerb++;
return fVerb != fEdge->fVerbs.end();
}
-
+
const SkPoint* lastPoints() const {
SkASSERT(fPts >= fEdge->fPts.begin() + lastVerb());
return &fPts[-lastVerb()];
@@ -1384,7 +1384,7 @@
if (fVerb != SkPath::kLine_Verb ? noIntersect(rh) : rh.noIntersect(*this)) {
return abCompare(fAbove, fBelow, rh.fAbove, rh.fBelow);
}
- // use whichever of top/tangent tangent/bottom overlaps more
+ // use whichever of top/tangent tangent/bottom overlaps more
// with line top/bot
// assumes quad/cubic can already be upconverted to cubic/cubic
const SkPoint* line[2];
@@ -1405,7 +1405,7 @@
// FIXME: code has been abandoned, incomplete....
return false;
}
-
+
bool abCompare(const SkPoint& a1, const SkPoint& a2, const SkPoint& b1,
const SkPoint& b2) const {
double topD = a1.fX - b1.fX;
@@ -1498,7 +1498,7 @@
SkASSERT(!fExplicitTs);
fTIndex = fTs->count() + 1;
}
-
+
void calcAboveBelow(double tAbove, double tBelow) {
fVerb = fWorkEdge.verb();
switch (fVerb) {
@@ -1520,7 +1520,7 @@
CubicSubDivide(fWorkEdge.fPts, tAbove, tBelow, cubic);
fAbove = cubic[0];
// FIXME: can't see how quad logic for how tangent is used
- // extends to cubic
+ // extends to cubic
fTangent = cubic[0] != cubic[1] ? cubic[1]
: cubic[0] != cubic[2] ? cubic[2] : cubic[3];
fBelow = cubic[3];
@@ -1574,7 +1574,7 @@
bool done(SkScalar bottom) const {
return fDone || fYBottom >= bottom;
}
-
+
void fixBelow() {
if (fFixBelow) {
fTBelow = nextT();
@@ -1636,11 +1636,11 @@
// SkPath::Verb lastVerb() const {
// return fDone ? fWorkEdge.lastVerb() : fWorkEdge.verb();
// }
-
+
const SkPoint* lastPoints() const {
return fDone ? fWorkEdge.lastPoints() : fWorkEdge.points();
}
-
+
bool noIntersect(const ActiveEdge& ) const {
// incomplete
return false;
@@ -1683,7 +1683,7 @@
}
return false;
}
-
+
bool swapUnordered(const ActiveEdge* edge, SkScalar /* bottom */) const {
SkASSERT(fVerb != SkPath::kLine_Verb
|| edge->fVerb != SkPath::kLine_Verb);
@@ -1771,7 +1771,7 @@
}
return IsCoincident(curveSample, lineEdge->fAbove, lineEdge->fBelow);
}
-
+
double nextT() const {
SkASSERT(fTIndex <= fTs->count() - fExplicitTs);
return t(fTIndex + 1);
@@ -1785,7 +1785,7 @@
if (fExplicitTs) {
SkASSERT(tIndex < fTs->count());
return (*fTs)[tIndex];
- }
+ }
if (tIndex == 0) {
return 0;
}
@@ -1805,7 +1805,7 @@
void extractAboveBelow(ActiveEdge& extracted) const {
SkPoint curve[4];
switch (fVerb) {
- case SkPath::kLine_Verb:
+ case SkPath::kLine_Verb:
extracted.fAbove = fAbove;
extracted.fTangent = fTangent;
return;
@@ -1854,10 +1854,10 @@
// Find any intersections in the range of active edges. A pair of edges, on
// either side of another edge, may change the winding contribution for part of
-// the edge.
+// the edge.
// Keep horizontal edges just for
// the purpose of computing when edges change their winding contribution, since
-// this is essentially computing the horizontal intersection.
+// this is essentially computing the horizontal intersection.
static void addBottomT(InEdge** currentPtr, InEdge** lastPtr,
HorizontalEdge** horizontal) {
InEdge** testPtr = currentPtr - 1;
@@ -2134,7 +2134,7 @@
return bottom;
}
-static SkScalar findBottom(InEdge** currentPtr,
+static SkScalar findBottom(InEdge** currentPtr,
InEdge** edgeListEnd, SkTDArray<ActiveEdge>* activeEdges, SkScalar y,
bool /*asFill*/, InEdge**& testPtr) {
InEdge* current = *currentPtr;
@@ -2154,7 +2154,7 @@
if (testTop > y) {
bottom = testTop;
break;
- }
+ }
if (y < testBottom) {
if (bottom > testBottom) {
bottom = testBottom;
@@ -2208,7 +2208,7 @@
ActiveEdge* activePtr, ActiveEdge* firstCoincident) {
if (((lastWinding & windingMask) == 0) ^ (winding & windingMask) != 0) {
return;
- }
+ }
// FIXME: ? shouldn't this be if (lastWinding & windingMask) ?
if (lastWinding) {
#if DEBUG_ADJUST_COINCIDENT
@@ -2374,7 +2374,7 @@
int priorWinding = winding;
winding += activePtr->fWorkEdge.winding();
nextPtr = edgeList[index];
- if (activePtr->fSkip && nextPtr->fSkip
+ if (activePtr->fSkip && nextPtr->fSkip
&& activePtr->fCoincident == nextPtr->fCoincident) {
if (!firstCoincident) {
firstCoincident = activePtr;
@@ -2441,7 +2441,7 @@
}
// stitch edge and t range that satisfies operation
-static void stitchEdge(SkTDArray<ActiveEdge*>& edgeList, SkScalar
+static void stitchEdge(SkTDArray<ActiveEdge*>& edgeList, SkScalar
#if DEBUG_STITCH_EDGE
y
#endif
@@ -2487,10 +2487,10 @@
SkPath::Verb verb = activePtr->fVerb;
do {
nextT = activePtr->nextT();
- // FIXME: obtuse: want efficient way to say
+ // FIXME: obtuse: want efficient way to say
// !currentT && currentT != 1 || !nextT && nextT != 1
if (currentT * nextT != 0 || currentT + nextT != 1) {
- // OPTIMIZATION: if !inWinding, we only need
+ // OPTIMIZATION: if !inWinding, we only need
// clipped[1].fY
switch (verb) {
case SkPath::kLine_Verb:
@@ -2551,7 +2551,7 @@
}
currentT = nextT;
moreToDo = activePtr->advanceT();
- activePtr->fYBottom = clipped[verb].fY; // was activePtr->fCloseCall ? bottom :
+ activePtr->fYBottom = clipped[verb].fY; // was activePtr->fCloseCall ? bottom :
// clearing the fSkip/fCloseCall bit here means that trailing edges
// fall out of sync, if one edge is long and another is a series of short pieces
@@ -2660,7 +2660,7 @@
// each contour will need to know whether it is CW or CCW, and then whether
// a ray from that contour hits any a contour that contains it. The ray can
// move to the left and then arbitrarily move up or down (as long as it never
- // moves to the right) to find a reference sibling contour or containing
+ // moves to the right) to find a reference sibling contour or containing
// contour. If the contour is part of an intersection, the companion contour
// that is part of the intersection can determine the containership.
if (builder.containsCurves()) {
diff --git a/experimental/Intersection/EdgeWalkerPolygon4x4_Test.cpp b/experimental/Intersection/EdgeWalkerPolygon4x4_Test.cpp
index befac71..624ef38 100755
--- a/experimental/Intersection/EdgeWalkerPolygon4x4_Test.cpp
+++ b/experimental/Intersection/EdgeWalkerPolygon4x4_Test.cpp
@@ -81,7 +81,7 @@
for (int a = 0; a < 16; ++a) {
for (int b = a ; b < 16; ++b) {
for (int c = b ; c < 16; ++c) {
- for (int d = c; d < 16; ++d) {
+ for (int d = c; d < 16; ++d) {
testsRun += dispatchTest4(testSimplify4x4QuadralateralsMain,
a, b, c, d);
}
diff --git a/experimental/Intersection/EdgeWalkerPolygons_Test.cpp b/experimental/Intersection/EdgeWalkerPolygons_Test.cpp
index 80ef527..78269c4 100644
--- a/experimental/Intersection/EdgeWalkerPolygons_Test.cpp
+++ b/experimental/Intersection/EdgeWalkerPolygons_Test.cpp
@@ -16,7 +16,7 @@
path.lineTo(20,30);
path.close();
testSimplify(path, true, out, bitmap); // expect |\/|
- // |__|
+ // |__|
}
static void testSimplifyTriangle3() {
@@ -232,7 +232,7 @@
path.close();
testSimplify(path, true, out, bitmap);
}
-
+
static void testSimplifyTriangle18() {
SkPath path, out;
path.moveTo(0, 0);
@@ -315,7 +315,7 @@
static void testSimplifyWindingParallelogram() {
SkPath path, out;
path.setFillType(SkPath::kWinding_FillType);
- path.moveTo(20,10); // parallelogram _
+ path.moveTo(20,10); // parallelogram _
path.lineTo(30,30); // \ \ .
path.lineTo(40,30); // \_\ .
path.lineTo(30,10);
@@ -326,13 +326,13 @@
path.lineTo(30,10);
path.close();
testSimplify(path, true, out, bitmap); // expect _
- // / \ .
+ // / \ .
} // /___\ .
static void testSimplifyXorParallelogram() {
SkPath path, out;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.moveTo(20,10); // parallelogram _
+ path.moveTo(20,10); // parallelogram _
path.lineTo(30,30); // \ \ .
path.lineTo(40,30); // \_\ .
path.lineTo(30,10);
@@ -352,7 +352,7 @@
path.lineTo(10,30); // |_\ .
path.lineTo(20,30);
path.close();
- path.moveTo(10,10); // triangle _
+ path.moveTo(10,10); // triangle _
path.lineTo(20,10); // \ |
path.lineTo(20,30); // \|
path.close(); // _
diff --git a/experimental/Intersection/EdgeWalkerQuadratic4x4_Test.cpp b/experimental/Intersection/EdgeWalkerQuadratic4x4_Test.cpp
index 1f5af8e..aa11a2f 100644
--- a/experimental/Intersection/EdgeWalkerQuadratic4x4_Test.cpp
+++ b/experimental/Intersection/EdgeWalkerQuadratic4x4_Test.cpp
@@ -81,7 +81,7 @@
for (int a = 0; a < 16; ++a) {
for (int b = a ; b < 16; ++b) {
for (int c = b ; c < 16; ++c) {
- for (int d = c; d < 16; ++d) {
+ for (int d = c; d < 16; ++d) {
testsRun += dispatchTest4(testSimplify4x4QuadraticsMain,
a, b, c, d);
}
diff --git a/experimental/Intersection/EdgeWalkerRectangles_Test.cpp b/experimental/Intersection/EdgeWalkerRectangles_Test.cpp
index a5448e3..f721aa9 100644
--- a/experimental/Intersection/EdgeWalkerRectangles_Test.cpp
+++ b/experimental/Intersection/EdgeWalkerRectangles_Test.cpp
@@ -64,7 +64,7 @@
if (out != expected) {
SkDebugf("%s expected equal\n", __FUNCTION__);
}
-
+
path = out;
path.addRect(30, 10, 40, 20);
path.addRect(10, 30, 20, 40);
@@ -76,7 +76,7 @@
if (rect != SkRect::MakeLTRB(10, 10, 40, 40)) {
SkDebugf("%s expected union\n", __FUNCTION__);
}
-
+
path = out;
path.addRect(10, 10, 40, 40, SkPath::kCCW_Direction);
simplify(path, true, out);
@@ -205,7 +205,7 @@
}
}
if (boundsPtr != bounds) {
- SkASSERT((bounds[0] == rect1 || bounds[1] == rect1)
+ SkASSERT((bounds[0] == rect1 || bounds[1] == rect1)
&& (bounds[0] == rect2 || bounds[1] == rect2));
} else {
SkASSERT(segments == 8);
@@ -228,7 +228,7 @@
case SkPath::kMove_Verb:
SkASSERT(count == 0);
break;
- case SkPath::kLine_Verb:
+ case SkPath::kLine_Verb:
SkASSERT(pts[0].fX == pts[1].fX || pts[0].fY == pts[1].fY);
++count;
break;
@@ -264,21 +264,21 @@
path.addRect(rect2, static_cast<SkPath::Direction>(inDir));
simplify(path, true, out);
assertOneContour(out, edge, extend);
-
+
path.reset();
rect1 = SkRect::MakeLTRB(start[startIndex], 40, stop[stopIndex], 50);
path.addRect(rect1, static_cast<SkPath::Direction>(outDir));
path.addRect(rect2, static_cast<SkPath::Direction>(inDir));
simplify(path, true, out);
assertOneContour(out, edge, extend);
-
+
path.reset();
rect1 = SkRect::MakeLTRB(0, start[startIndex], 10, stop[stopIndex]);
path.addRect(rect1, static_cast<SkPath::Direction>(outDir));
path.addRect(rect2, static_cast<SkPath::Direction>(inDir));
simplify(path, true, out);
assertOneContour(out, edge, extend);
-
+
path.reset();
rect1 = SkRect::MakeLTRB(40, start[startIndex], 50, stop[stopIndex]);
path.addRect(rect1, static_cast<SkPath::Direction>(outDir));
@@ -362,7 +362,7 @@
if (rect != rect2) {
SkDebugf("%s 1 expected union\n", __FUNCTION__);
}
-
+
path.reset();
rect1 = SkRect::MakeLTRB(start[startIndex], 40, stop[stopIndex], 40);
path.addRect(rect1, static_cast<SkPath::Direction>(outDir));
@@ -374,7 +374,7 @@
if (rect != rect2) {
SkDebugf("%s 2 expected union\n", __FUNCTION__);
}
-
+
path.reset();
rect1 = SkRect::MakeLTRB(0, start[startIndex], 0, stop[stopIndex]);
path.addRect(rect1, static_cast<SkPath::Direction>(outDir));
@@ -386,7 +386,7 @@
if (rect != rect2) {
SkDebugf("%s 3 expected union\n", __FUNCTION__);
}
-
+
path.reset();
rect1 = SkRect::MakeLTRB(40, start[startIndex], 40, stop[stopIndex]);
path.addRect(rect1, static_cast<SkPath::Direction>(outDir));
@@ -430,10 +430,10 @@
testSimplifyCoincident,
testSimplifyCoincidentCW,
testSimplifyCoincidentCCW,
- testSimplifyCoincidentVertical,
+ testSimplifyCoincidentVertical,
testSimplifyCoincidentHorizontal,
- testSimplifyAddL,
- testSimplifyMulti,
+ testSimplifyAddL,
+ testSimplifyMulti,
};
static size_t simplifyTestsCount = sizeof(simplifyTests) / sizeof(simplifyTests[0]);
diff --git a/experimental/Intersection/EdgeWalker_Test.h b/experimental/Intersection/EdgeWalker_Test.h
index d0ae3a5..2a7d5d1 100644
--- a/experimental/Intersection/EdgeWalker_Test.h
+++ b/experimental/Intersection/EdgeWalker_Test.h
@@ -37,7 +37,7 @@
int d; // sometimes 1 if abc_is_a_triangle
int testsRun;
char filename[256];
-
+
SkCanvas* canvas;
SkBitmap bitmap;
};
diff --git a/experimental/Intersection/IntersectionUtilities.cpp b/experimental/Intersection/IntersectionUtilities.cpp
index 63a5767..7321fef 100644
--- a/experimental/Intersection/IntersectionUtilities.cpp
+++ b/experimental/Intersection/IntersectionUtilities.cpp
@@ -28,13 +28,13 @@
// to subtract another 52 from it.
exponent -= 1075;
- if (mantissa == 0)
+ if (mantissa == 0)
{
return "0";
}
/* Normalize */
- while((mantissa & 1) == 0)
+ while((mantissa & 1) == 0)
{ /* i.e., Mantissa is even */
mantissa >>= 1;
exponent++;
diff --git a/experimental/Intersection/IntersectionUtilities.h b/experimental/Intersection/IntersectionUtilities.h
index 3dfd311..6ed7f96 100644
--- a/experimental/Intersection/IntersectionUtilities.h
+++ b/experimental/Intersection/IntersectionUtilities.h
@@ -14,7 +14,7 @@
/* Given the set [0, 1, 2, 3], and two of the four members, compute an XOR mask
that computes the other two. Note that:
-
+
one ^ two == 3 for (0, 3), (1, 2)
one ^ two < 3 for (0, 1), (0, 2), (1, 3), (2, 3)
3 - (one ^ two) is either 0, 1, or 2
diff --git a/experimental/Intersection/Intersection_Tests.cpp b/experimental/Intersection/Intersection_Tests.cpp
index bf28ccb..100e32c 100644
--- a/experimental/Intersection/Intersection_Tests.cpp
+++ b/experimental/Intersection/Intersection_Tests.cpp
@@ -24,7 +24,7 @@
QuadraticBezierClip_Test();
QuadraticIntersection_Test();
SimplifyAddIntersectingTs_Test();
-
+
cubecode_test(1);
convert_testx();
// tests are in dependency / complexity order
diff --git a/experimental/Intersection/Intersections.h b/experimental/Intersection/Intersections.h
index 47c413a..879b54e 100644
--- a/experimental/Intersection/Intersections.h
+++ b/experimental/Intersection/Intersections.h
@@ -36,7 +36,7 @@
void swap() {
fSwap ^= 1;
}
-
+
bool swapped() {
return fSwap;
}
diff --git a/experimental/Intersection/LineCubicIntersection.cpp b/experimental/Intersection/LineCubicIntersection.cpp
index aaee2a1..a210fb3 100644
--- a/experimental/Intersection/LineCubicIntersection.cpp
+++ b/experimental/Intersection/LineCubicIntersection.cpp
@@ -19,12 +19,12 @@
line:
(in) Resultant[
- a*(1 - t)^3 + 3*b*(1 - t)^2*t + 3*c*(1 - t)*t^2 + d*t^3 - x,
+ a*(1 - t)^3 + 3*b*(1 - t)^2*t + 3*c*(1 - t)*t^2 + d*t^3 - x,
e*(1 - t)^3 + 3*f*(1 - t)^2*t + 3*g*(1 - t)*t^2 + h*t^3 - i*x - j, x]
(out) -e + j +
3 e t - 3 f t -
3 e t^2 + 6 f t^2 - 3 g t^2 +
- e t^3 - 3 f t^3 + 3 g t^3 - h t^3 +
+ e t^3 - 3 f t^3 + 3 g t^3 - h t^3 +
i ( a -
3 a t + 3 b t +
3 a t^2 - 6 b t^2 + 3 c t^2 -
@@ -33,14 +33,14 @@
if i goes to infinity, we can rewrite the line in terms of x. Mathematica:
(in) Resultant[
- a*(1 - t)^3 + 3*b*(1 - t)^2*t + 3*c*(1 - t)*t^2 + d*t^3 - i*y - j,
+ a*(1 - t)^3 + 3*b*(1 - t)^2*t + 3*c*(1 - t)*t^2 + d*t^3 - i*y - j,
e*(1 - t)^3 + 3*f*(1 - t)^2*t + 3*g*(1 - t)*t^2 + h*t^3 - y, y]
- (out) a - j -
- 3 a t + 3 b t +
+ (out) a - j -
+ 3 a t + 3 b t +
3 a t^2 - 6 b t^2 + 3 c t^2 -
- a t^3 + 3 b t^3 - 3 c t^3 + d t^3 -
- i ( e -
- 3 e t + 3 f t +
+ a t^3 + 3 b t^3 - 3 c t^3 + d t^3 -
+ i ( e -
+ 3 e t + 3 f t +
3 e t^2 - 6 f t^2 + 3 g t^2 -
e t^3 + 3 f t^3 - 3 g t^3 + h t^3 )
@@ -58,13 +58,13 @@
B = 3*( ( a - 2*b + c ) - i*( e - 2*f + g ) )
C = 3*( (-a + b ) - i*(-e + f ) )
D = ( ( a ) - i*( e ) - j )
-
+
For horizontal lines:
(in) Resultant[
- a*(1 - t)^3 + 3*b*(1 - t)^2*t + 3*c*(1 - t)*t^2 + d*t^3 - j,
+ a*(1 - t)^3 + 3*b*(1 - t)^2*t + 3*c*(1 - t)*t^2 + d*t^3 - j,
e*(1 - t)^3 + 3*f*(1 - t)^2*t + 3*g*(1 - t)*t^2 + h*t^3 - y, y]
(out) e - j -
- 3 e t + 3 f t +
+ 3 e t + 3 f t +
3 e t^2 - 6 f t^2 + 3 g t^2 -
e t^3 + 3 f t^3 - 3 g t^3 + h t^3
So the cubic coefficients are:
diff --git a/experimental/Intersection/LineIntersection.cpp b/experimental/Intersection/LineIntersection.cpp
index 3efa240..6271edc 100644
--- a/experimental/Intersection/LineIntersection.cpp
+++ b/experimental/Intersection/LineIntersection.cpp
@@ -15,7 +15,7 @@
double ayLen = a[1].y - a[0].y;
double bxLen = b[1].x - b[0].x;
double byLen = b[1].y - b[0].y;
- /* Slopes match when denom goes to zero:
+ /* Slopes match when denom goes to zero:
axLen / ayLen == bxLen / byLen
(ayLen * byLen) * axLen / ayLen == (ayLen * byLen) * bxLen / byLen
byLen * axLen == ayLen * bxLen
@@ -309,11 +309,11 @@
// from http://www.bryceboe.com/wordpress/wp-content/uploads/2006/10/intersect.py
// 4 subs, 2 muls, 1 cmp
static bool ccw(const _Point& A, const _Point& B, const _Point& C) {
- return (C.y - A.y) * (B.x - A.x) > (B.y - A.y) * (C.x - A.x);
+ return (C.y - A.y) * (B.x - A.x) > (B.y - A.y) * (C.x - A.x);
}
// 16 subs, 8 muls, 6 cmps
bool testIntersect(const _Line& a, const _Line& b) {
- return ccw(a[0], b[0], b[1]) != ccw(a[1], b[0], b[1])
+ return ccw(a[0], b[0], b[1]) != ccw(a[1], b[0], b[1])
&& ccw(a[0], a[1], b[0]) != ccw(a[0], a[1], b[1]);
}
diff --git a/experimental/Intersection/LineIntersection_Test.cpp b/experimental/Intersection/LineIntersection_Test.cpp
index c73c9b3..935a168 100644
--- a/experimental/Intersection/LineIntersection_Test.cpp
+++ b/experimental/Intersection/LineIntersection_Test.cpp
@@ -9,7 +9,7 @@
{{{0, 1}, {0, 1}}, {{0, 0}, {0, 2}}},
{{{0, 0}, {1, 0}}, {{0, 0}, {2, 0}}},
{{{1, 1}, {2, 2}}, {{0, 0}, {3, 3}}},
- {{{166.86950047022856, 112.69654129527828}, {166.86948801592692, 112.69655741235339}},
+ {{{166.86950047022856, 112.69654129527828}, {166.86948801592692, 112.69655741235339}},
{{166.86960700313026, 112.6965477747386}, {166.86925794355412, 112.69656471103423}}}
};
diff --git a/experimental/Intersection/LineParameterization.cpp b/experimental/Intersection/LineParameterization.cpp
index 8bf8acd..83d973e 100644
--- a/experimental/Intersection/LineParameterization.cpp
+++ b/experimental/Intersection/LineParameterization.cpp
@@ -8,7 +8,7 @@
_Point oneD, twoD;
tangent(one, oneD);
tangent(two, twoD);
- /* See if the slopes match, i.e.
+ /* See if the slopes match, i.e.
dx1 / dy1 == dx2 / dy2
(dy1 * dy2) * dx1 / dy1 == (dy1 * dy2) * dx2 / dy2
dy2 * dx1 == dy1 * dx2
@@ -32,7 +32,7 @@
_Point oneD, twoD;
tangent(one, oneD);
tangent(two, twoD);
- /* See if the slopes match, i.e.
+ /* See if the slopes match, i.e.
dx1 / dy1 == dx2 / dy2
(dy1 * dy2) * dx1 / dy1 == (dy1 * dy2) * dx2 / dy2
dy2 * dx1 == dy1 * dx2
diff --git a/experimental/Intersection/LineParameters.h b/experimental/Intersection/LineParameters.h
index 202ba46..582ca47 100644
--- a/experimental/Intersection/LineParameters.h
+++ b/experimental/Intersection/LineParameters.h
@@ -20,19 +20,19 @@
b = pts[3].x - pts[0].x;
c = pts[0].x * pts[3].y - pts[3].x * pts[0].y;
}
-
+
void cubicEndPoints(const Cubic& pts, int s, int e) {
a = pts[s].y - pts[e].y;
b = pts[e].x - pts[s].x;
c = pts[s].x * pts[e].y - pts[e].x * pts[s].y;
}
-
+
void lineEndPoints(const _Line& pts) {
a = pts[0].y - pts[1].y;
b = pts[1].x - pts[0].x;
c = pts[0].x * pts[1].y - pts[1].x * pts[0].y;
}
-
+
void quadEndPoints(const Quadratic& pts) {
a = pts[0].y - pts[2].y;
b = pts[2].x - pts[0].x;
@@ -61,7 +61,7 @@
c *= reciprocal;
return true;
}
-
+
void cubicDistanceY(const Cubic& pts, Cubic& distance) {
double oneThird = 1 / 3.0;
for (int index = 0; index < 4; ++index) {
@@ -83,16 +83,16 @@
distance[index] = a * pts[index + 1].x + b * pts[index + 1].y + c;
}
}
-
+
void controlPtDistance(const Cubic& pts, int i, int j, double distance[2]) {
distance[0] = a * pts[i].x + b * pts[i].y + c;
distance[1] = a * pts[j].x + b * pts[j].y + c;
}
-
+
double controlPtDistance(const Quadratic& pts) {
return a * pts[1].x + b * pts[1].y + c;
}
-
+
double pointDistance(const _Point& pt) {
return a * pt.x + b * pt.y + c;
}
diff --git a/experimental/Intersection/LineParameteters_Test.cpp b/experimental/Intersection/LineParameteters_Test.cpp
index f806250..92e8001 100644
--- a/experimental/Intersection/LineParameteters_Test.cpp
+++ b/experimental/Intersection/LineParameteters_Test.cpp
@@ -13,7 +13,7 @@
{{0, .002}, {1, 0}, {2, 0}, {3, 0}},
{{0, .0002}, {1, 0}, {2, 0}, {3, 0}},
{{0, .00002}, {1, 0}, {2, 0}, {3, 0}},
- {{0, PointEpsilon * 2}, {1, 0}, {2, 0}, {3, 0}},
+ {{0, PointEpsilon * 2}, {1, 0}, {2, 0}, {3, 0}},
};
const double answers[][2] = {
@@ -60,7 +60,7 @@
double normalizedDistance[2];
lineParameters.controlPtDistance(cubic, normalizedDistance);
for (inner = 0; inner < 2; ++inner) {
- if (approximately_equal(fabs(normalizedDistance[inner]),
+ if (approximately_equal(fabs(normalizedDistance[inner]),
answers[index][inner])) {
continue;
}
diff --git a/experimental/Intersection/LineQuadraticIntersection.cpp b/experimental/Intersection/LineQuadraticIntersection.cpp
index c3e6d23..f269b71 100644
--- a/experimental/Intersection/LineQuadraticIntersection.cpp
+++ b/experimental/Intersection/LineQuadraticIntersection.cpp
@@ -3,13 +3,13 @@
#include "LineUtilities.h"
#include "QuadraticUtilities.h"
-/*
+/*
Find the interection of a line and quadratic by solving for valid t values.
From http://stackoverflow.com/questions/1853637/how-to-find-the-mathematical-function-defining-a-bezier-curve
-"A Bezier curve is a parametric function. A quadratic Bezier curve (i.e. three
-control points) can be expressed as: F(t) = A(1 - t)^2 + B(1 - t)t + Ct^2 where
+"A Bezier curve is a parametric function. A quadratic Bezier curve (i.e. three
+control points) can be expressed as: F(t) = A(1 - t)^2 + B(1 - t)t + Ct^2 where
A, B and C are points and t goes from zero to one.
This will give you two equations:
@@ -17,7 +17,7 @@
x = a(1 - t)^2 + b(1 - t)t + ct^2
y = d(1 - t)^2 + e(1 - t)t + ft^2
-If you add for instance the line equation (y = kx + m) to that, you'll end up
+If you add for instance the line equation (y = kx + m) to that, you'll end up
with three equations and three unknowns (x, y and t)."
Similar to above, the quadratic is represented as
@@ -29,24 +29,24 @@
Using Mathematica, solve for the values of t where the quadratic intersects the
line:
- (in) t1 = Resultant[a*(1 - t)^2 + 2*b*(1 - t)*t + c*t^2 - x,
+ (in) t1 = Resultant[a*(1 - t)^2 + 2*b*(1 - t)*t + c*t^2 - x,
d*(1 - t)^2 + 2*e*(1 - t)*t + f*t^2 - g*x - h, x]
- (out) -d + h + 2 d t - 2 e t - d t^2 + 2 e t^2 - f t^2 +
+ (out) -d + h + 2 d t - 2 e t - d t^2 + 2 e t^2 - f t^2 +
g (a - 2 a t + 2 b t + a t^2 - 2 b t^2 + c t^2)
(in) Solve[t1 == 0, t]
(out) {
{t -> (-2 d + 2 e + 2 a g - 2 b g -
- Sqrt[(2 d - 2 e - 2 a g + 2 b g)^2 -
+ Sqrt[(2 d - 2 e - 2 a g + 2 b g)^2 -
4 (-d + 2 e - f + a g - 2 b g + c g) (-d + a g + h)]) /
(2 (-d + 2 e - f + a g - 2 b g + c g))
},
{t -> (-2 d + 2 e + 2 a g - 2 b g +
- Sqrt[(2 d - 2 e - 2 a g + 2 b g)^2 -
+ Sqrt[(2 d - 2 e - 2 a g + 2 b g)^2 -
4 (-d + 2 e - f + a g - 2 b g + c g) (-d + a g + h)]) /
(2 (-d + 2 e - f + a g - 2 b g + c g))
}
}
-
+
Using the results above (when the line tends towards horizontal)
A = (-(d - 2*e + f) + g*(a - 2*b + c) )
B = 2*( (d - e ) - g*(a - b ) )
@@ -57,19 +57,19 @@
And solve accordingly in Mathematica:
- (in) t2 = Resultant[a*(1 - t)^2 + 2*b*(1 - t)*t + c*t^2 - g'*y - h',
+ (in) t2 = Resultant[a*(1 - t)^2 + 2*b*(1 - t)*t + c*t^2 - g'*y - h',
d*(1 - t)^2 + 2*e*(1 - t)*t + f*t^2 - y, y]
- (out) a - h' - 2 a t + 2 b t + a t^2 - 2 b t^2 + c t^2 -
+ (out) a - h' - 2 a t + 2 b t + a t^2 - 2 b t^2 + c t^2 -
g' (d - 2 d t + 2 e t + d t^2 - 2 e t^2 + f t^2)
(in) Solve[t2 == 0, t]
(out) {
{t -> (2 a - 2 b - 2 d g' + 2 e g' -
- Sqrt[(-2 a + 2 b + 2 d g' - 2 e g')^2 -
+ Sqrt[(-2 a + 2 b + 2 d g' - 2 e g')^2 -
4 (a - 2 b + c - d g' + 2 e g' - f g') (a - d g' - h')]) /
(2 (a - 2 b + c - d g' + 2 e g' - f g'))
},
{t -> (2 a - 2 b - 2 d g' + 2 e g' +
- Sqrt[(-2 a + 2 b + 2 d g' - 2 e g')^2 -
+ Sqrt[(-2 a + 2 b + 2 d g' - 2 e g')^2 -
4 (a - 2 b + c - d g' + 2 e g' - f g') (a - d g' - h')])/
(2 (a - 2 b + c - d g' + 2 e g' - f g'))
}
@@ -80,7 +80,7 @@
B = 2*(-(a - b ) + g'*(d - e ) )
C = ( (a ) - g'*(d ) - h' )
*/
-
+
class LineQuadraticIntersections : public Intersections {
public:
@@ -156,7 +156,7 @@
}
protected:
-
+
double findLineT(double t) {
const double* qPtr;
const double* lPtr;
diff --git a/experimental/Intersection/LineQuadraticIntersection_Test.cpp b/experimental/Intersection/LineQuadraticIntersection_Test.cpp
index e641fdc..2bb8c6c 100644
--- a/experimental/Intersection/LineQuadraticIntersection_Test.cpp
+++ b/experimental/Intersection/LineQuadraticIntersection_Test.cpp
@@ -15,7 +15,7 @@
{{{1, 1}, {2, 1}, {0, 2}}, {{0, 0}, {1, 1}}, 1, {{1, 1} }},
{{{0, 0}, {1, 1}, {3, 1}}, {{0, 0}, {3, 1}}, 2, {{0, 0}, {3, 1}}},
{{{2, 0}, {1, 1}, {2, 2}}, {{0, 0}, {0, 2}}, 0 },
- {{{4, 0}, {0, 1}, {4, 2}}, {{3, 1}, {4, 1}}, 0, },
+ {{{4, 0}, {0, 1}, {4, 2}}, {{3, 1}, {4, 1}}, 0, },
{{{0, 0}, {0, 1}, {1, 1}}, {{0, 1}, {1, 0}}, 1, {{.25, .75} }},
};
@@ -100,7 +100,7 @@
}
}
-static void testLineIntersect(State4& state, const Quadratic& quad, const _Line& line,
+static void testLineIntersect(State4& state, const Quadratic& quad, const _Line& line,
const double x, const double y) {
char pathStr[1024];
bzero(pathStr, sizeof(pathStr));
@@ -109,7 +109,7 @@
str += sprintf(str, " path.quadTo(%1.9g, %1.9g, %1.9g, %1.9g);\n", quad[1].x, quad[1].y, quad[2].x, quad[2].y);
str += sprintf(str, " path.moveTo(%1.9g, %1.9g);\n", line[0].x, line[0].y);
str += sprintf(str, " path.lineTo(%1.9g, %1.9g);\n", line[1].x, line[1].y);
-
+
Intersections intersections;
bool flipped = false;
int result = doIntersect(intersections, quad, line, flipped);
diff --git a/experimental/Intersection/LineUtilities.cpp b/experimental/Intersection/LineUtilities.cpp
index 8a1c0d7..32ea54d 100644
--- a/experimental/Intersection/LineUtilities.cpp
+++ b/experimental/Intersection/LineUtilities.cpp
@@ -31,7 +31,7 @@
dst[1].y = line[0].y - t2 * delta.y;
}
-// may have this below somewhere else already:
+// may have this below somewhere else already:
// copying here because I thought it was clever
// Copyright 2001, softSurfer (www.softsurfer.com)
@@ -86,15 +86,15 @@
int flags, double& minX, double& maxX) {
if (approximately_equal(p1.y, p2.y)) {
// It should be OK to bail early in this case. There's another edge
- // which shares this end point which can intersect without failing to
+ // which shares this end point which can intersect without failing to
// have a slope ... maybe
return;
}
-
+
// p2.x is always greater than p1.x -- the part of points (p1, p2) are
// moving from the start of the cubic towards its end.
// if p1.y < p2.y, minX can be affected
- // if p1.y > p2.y, maxX can be affected
+ // if p1.y > p2.y, maxX can be affected
double slope = (p2.x - p1.x) / (p2.y - p1.y);
int topFlags = flags & (kFindTopMin | kFindTopMax);
if (topFlags && (top <= p1.y && top >= p2.y
diff --git a/experimental/Intersection/QuadraticBezierClip.cpp b/experimental/Intersection/QuadraticBezierClip.cpp
index e27db7c..ce6efad 100644
--- a/experimental/Intersection/QuadraticBezierClip.cpp
+++ b/experimental/Intersection/QuadraticBezierClip.cpp
@@ -10,7 +10,7 @@
maxT = 0;
// determine normalized implicit line equation for pt[0] to pt[3]
// of the form ax + by + c = 0, where a*a + b*b == 1
-
+
// find the implicit line equation parameters
LineParameters endLine;
endLine.quadEndPoints(q1);
@@ -20,18 +20,18 @@
}
double distance = endLine.controlPtDistance(q1);
-
+
// find fat line
double top = 0;
double bottom = distance / 2; // http://students.cs.byu.edu/~tom/557/text/cic.pdf (7.6)
if (top > bottom) {
std::swap(top, bottom);
}
-
+
// compute intersecting candidate distance
Quadratic distance2y; // points with X of (0, 1/2, 1)
endLine.quadDistanceY(q2, distance2y);
-
+
int flags = 0;
if (approximately_lesser(distance2y[0].y, top)) {
flags |= kFindTopMin;
@@ -57,6 +57,6 @@
}
x_at(distance2y[idx], distance2y[next], top, bottom, flags, minT, maxT);
idx = next;
- } while (idx);
+ } while (idx);
return minT < maxT; // returns false if distance shows no intersection
}
diff --git a/experimental/Intersection/QuadraticIntersection.cpp b/experimental/Intersection/QuadraticIntersection.cpp
index a8e87ef..6067275 100644
--- a/experimental/Intersection/QuadraticIntersection.cpp
+++ b/experimental/Intersection/QuadraticIntersection.cpp
@@ -6,11 +6,11 @@
class QuadraticIntersections : public Intersections {
public:
-QuadraticIntersections(const Quadratic& q1, const Quadratic& q2, Intersections& i)
+QuadraticIntersections(const Quadratic& q1, const Quadratic& q2, Intersections& i)
: quad1(q1)
, quad2(q2)
, intersections(i)
- , depth(0)
+ , depth(0)
, splits(0) {
}
@@ -37,10 +37,10 @@
}
protected:
-
+
bool intersect(double minT1, double maxT1, double minT2, double maxT2) {
Quadratic smaller, larger;
- // FIXME: carry last subdivide and reduceOrder result with quad
+ // FIXME: carry last subdivide and reduceOrder result with quad
sub_divide(quad1, minT1, maxT1, intersections.swapped() ? larger : smaller);
sub_divide(quad2, minT2, maxT2, intersections.swapped() ? smaller : larger);
Quadratic smallResult;
@@ -55,11 +55,11 @@
return false;
}
if (intersections.swapped()) {
- smallT[0] = interp(minT2, maxT2, smallT[0]);
- largeT[0] = interp(minT1, maxT1, largeT[0]);
+ smallT[0] = interp(minT2, maxT2, smallT[0]);
+ largeT[0] = interp(minT1, maxT1, largeT[0]);
} else {
- smallT[0] = interp(minT1, maxT1, smallT[0]);
- largeT[0] = interp(minT2, maxT2, largeT[0]);
+ smallT[0] = interp(minT1, maxT1, smallT[0]);
+ largeT[0] = interp(minT2, maxT2, largeT[0]);
}
intersections.add(smallT[0], largeT[0]);
return true;
@@ -80,7 +80,7 @@
}
return false;
}
-
+
int split;
if (intersections.swapped()) {
double newMinT1 = interp(minT1, maxT1, minT);
@@ -210,11 +210,11 @@
where the sign of the imaginary part of the root is taken to be same as the sign
of the imaginary part of the original number, and
-
+
r = abs(x + iy) = sqrt(x^2 + y^2)
-is the absolute value or modulus of the original number. The real part of the
+is the absolute value or modulus of the original number. The real part of the
principal value is always non-negative.
-The other square root is simply –1 times the principal square root; in other
+The other square root is simply –1 times the principal square root; in other
words, the two square roots of a number sum to 0.
*/
diff --git a/experimental/Intersection/QuadraticParameterization.cpp b/experimental/Intersection/QuadraticParameterization.cpp
index fb45b17..675b197 100644
--- a/experimental/Intersection/QuadraticParameterization.cpp
+++ b/experimental/Intersection/QuadraticParameterization.cpp
@@ -3,7 +3,7 @@
/* from http://tom.cs.byu.edu/~tom/papers/cvgip84.pdf 4.1
*
- * This paper proves that Syvester's method can compute the implicit form of
+ * This paper proves that Syvester's method can compute the implicit form of
* the quadratic from the parameterized form.
*
* Given x = a*t*t + b*t + c (the parameterized form)
diff --git a/experimental/Intersection/QuadraticParameterization_Test.cpp b/experimental/Intersection/QuadraticParameterization_Test.cpp
index e355140..793b796 100644
--- a/experimental/Intersection/QuadraticParameterization_Test.cpp
+++ b/experimental/Intersection/QuadraticParameterization_Test.cpp
@@ -27,7 +27,7 @@
for (size_t two = 0; two < quadsCount; ++two) {
for (size_t inner = 0; inner < 3; inner += 2) {
if (!point_on_parameterized_curve(*quads[one], (*quads[two])[inner])) {
- printf("%s %zu [%zu,%zu] %zu parameterization failed\n",
+ printf("%s %zu [%zu,%zu] %zu parameterization failed\n",
__FUNCTION__, index, one, two, inner);
}
}
diff --git a/experimental/Intersection/QuadraticReduceOrder.cpp b/experimental/Intersection/QuadraticReduceOrder.cpp
index 7429f6e..5d614f1 100644
--- a/experimental/Intersection/QuadraticReduceOrder.cpp
+++ b/experimental/Intersection/QuadraticReduceOrder.cpp
@@ -118,7 +118,7 @@
// reduce to a quadratic or smaller
// look for identical points
-// look for all four points in a line
+// look for all four points in a line
// note that three points in a line doesn't simplify a cubic
// look for approximation with single quadratic
// save approximation with multiple quadratics for later
diff --git a/experimental/Intersection/QuadraticSubDivide.cpp b/experimental/Intersection/QuadraticSubDivide.cpp
index 7c3164e..9aee1df 100644
--- a/experimental/Intersection/QuadraticSubDivide.cpp
+++ b/experimental/Intersection/QuadraticSubDivide.cpp
@@ -18,7 +18,7 @@
12_ = B/2 + C/2
123 = A/4 + B/2 + C/4
= D
-
+
Group the known values on one side:
B = D*2 - A/2 - C/2
diff --git a/experimental/Intersection/QuadraticUtilities.cpp b/experimental/Intersection/QuadraticUtilities.cpp
index 88524ca..d42f1e2 100644
--- a/experimental/Intersection/QuadraticUtilities.cpp
+++ b/experimental/Intersection/QuadraticUtilities.cpp
@@ -11,7 +11,7 @@
t1 = Q / A
t2 = C / Q
-
+
*/
int quadraticRoots(double A, double B, double C, double t[2]) {
diff --git a/experimental/Intersection/Simplify.cpp b/experimental/Intersection/Simplify.cpp
index 9606589..5a026c8 100644
--- a/experimental/Intersection/Simplify.cpp
+++ b/experimental/Intersection/Simplify.cpp
@@ -486,7 +486,7 @@
}
return dx * rdy < rdx * dy;
}
-
+
double dx() const {
return fDx;
}
@@ -575,15 +575,15 @@
}
SkASSERT(0); // FIXME: add cubic case
}
-
+
Segment* segment() const {
return const_cast<Segment*>(fSegment);
}
-
+
int sign() const {
return SkSign32(fStart - fEnd);
}
-
+
int start() const {
return fStart;
}
@@ -745,7 +745,7 @@
int oIndex = span->fOtherIndex;
return other->activeAngleInner(oIndex, done, angles);
}
-
+
bool activeAngleInner(int index, int& done, SkTDArray<Angle>& angles) const {
int next = nextSpan(index, 1);
if (next > 0) {
@@ -828,7 +828,7 @@
// fTs[tIndexStart - 1], fTs[tIndexStart], fTs[tIndex]
// if tIndexStart == 0, no prior span
// if nextT == 1, no following span
-
+
// advance the span with zero winding
// if the following span exists (not past the end, non-zero winding)
// connect the two edges
@@ -873,7 +873,7 @@
}
}
}
-
+
void addCoinOutsides(const SkTDArray<double>& outsideTs, Segment& other,
double oEnd) {
// walk this to outsideTs[0]
@@ -910,7 +910,7 @@
addTPair(tStart, other, oStart, false);
} while (tStart < 1 && oStart < 1 && oEnd - oStart >= FLT_EPSILON);
}
-
+
void addCubic(const SkPoint pts[4]) {
init(pts, SkPath::kCubic_Verb);
fBounds.setCubicBounds(pts);
@@ -976,7 +976,7 @@
init(pts, SkPath::kQuad_Verb);
fBounds.setQuadBounds(pts);
}
-
+
// Defer all coincident edge processing until
// after normal intersections have been computed
@@ -1022,7 +1022,7 @@
span->fWindValue = 1;
if ((span->fDone = newT == 1)) {
++fDoneSpans;
- }
+ }
return insertedAt;
}
@@ -1083,7 +1083,7 @@
break;
}
oSpan = &other.fTs[--oIndex];
- }
+ }
test = span;
oTest = oSpan;
} while (test->fT < endT - FLT_EPSILON);
@@ -1197,7 +1197,7 @@
other.addCoinOutsides(oOutsideTs, *this, endT);
}
}
-
+
// FIXME: this doesn't prevent the same span from being added twice
// fix in caller, assert here?
void addTPair(double t, Segment& other, double otherT, bool borrowWind) {
@@ -1226,7 +1226,7 @@
matchWindingValue(insertedAt, t, borrowWind);
other.matchWindingValue(otherInsertedAt, otherT, borrowWind);
}
-
+
void addTwoAngles(int start, int end, SkTDArray<Angle>& angles) const {
// add edge leading into junction
if (fTs[SkMin32(end, start)].fWindValue > 0) {
@@ -1239,7 +1239,7 @@
addAngle(angles, end, tIndex);
}
}
-
+
const Bounds& bounds() const {
return fBounds;
}
@@ -1292,7 +1292,7 @@
SkASSERT(0); // incomplete
return false;
}
-
+
int computeSum(int startIndex, int endIndex) {
SkTDArray<Angle> angles;
addTwoAngles(startIndex, endIndex, angles);
@@ -1300,7 +1300,7 @@
SkTDArray<Angle*> sorted;
sortAngles(angles, sorted);
#if DEBUG_SORT
- sorted[0]->segment()->debugShowSort(__FUNCTION__, sorted, 0, 0);
+ sorted[0]->segment()->debugShowSort(__FUNCTION__, sorted, 0, 0);
#endif
int angleCount = angles.count();
const Angle* angle;
@@ -1365,7 +1365,7 @@
continue;
}
SkPoint edge[4];
- // OPTIMIZE: wrap this so that if start==0 end==fTCount-1 we can
+ // OPTIMIZE: wrap this so that if start==0 end==fTCount-1 we can
// work with the original data directly
double startT = fTs[start].fT;
double endT = fTs[end].fT;
@@ -1428,7 +1428,7 @@
}
return false;
}
-
+
bool decrementSpan(Span* span) {
SkASSERT(span->fWindValue > 0);
if (--(span->fWindValue) == 0) {
@@ -1460,7 +1460,7 @@
// reference an unused other
// for coincident, the last span on the other may be marked done
// (always?)
-
+
// if loop is exhausted, contour may be closed.
// FIXME: pass in close point so we can check for closure
@@ -1469,7 +1469,7 @@
// segments, find the mate that continues the outside.
// note that if there are multiples, but no coincidence, we can limit
// choices to connections in the correct direction
-
+
// mark found segments as done
// start is the index of the beginning T of this edge
@@ -1539,7 +1539,7 @@
// FIXME: found done logic probably fails if there are more than 4
// sorted angles. It should bias towards the first and last undone
// edges -- but not sure that it won't choose a middle (incorrect)
- // edge if one is undone
+ // edge if one is undone
bool foundDone = false;
bool foundDone2 = false;
// iterate through the angle, and compute everyone's winding
@@ -1651,7 +1651,7 @@
#endif
return nextSegment;
}
-
+
Segment* findNextXor(int& nextStart, int& nextEnd) {
const int startIndex = nextStart;
const int endIndex = nextEnd;
@@ -1923,7 +1923,7 @@
SkTDArray<Angle*> sorted;
sortAngles(angles, sorted);
#if DEBUG_SORT
- sorted[0]->segment()->debugShowSort(__FUNCTION__, sorted, 0, 0);
+ sorted[0]->segment()->debugShowSort(__FUNCTION__, sorted, 0, 0);
#endif
// skip edges that have already been processed
firstT = -1;
@@ -1936,7 +1936,7 @@
} while (leftSegment->fTs[SkMin32(tIndex, endIndex)].fDone);
return leftSegment;
}
-
+
// FIXME: not crazy about this
// when the intersections are performed, the other index is into an
// incomplete array. as the array grows, the indices become incorrect
@@ -1959,7 +1959,7 @@
}
}
}
-
+
// OPTIMIZATION: uses tail recursion. Unwise?
Span* innerChaseDone(int index, int step, int winding) {
int end = nextSpan(index, step);
@@ -1975,7 +1975,7 @@
other->markDone(SkMin32(index, otherEnd), winding);
return last;
}
-
+
Span* innerChaseWinding(int index, int step, int winding) {
int end = nextSpan(index, step);
SkASSERT(end >= 0);
@@ -1995,7 +1995,7 @@
other->markWinding(min, winding);
return last;
}
-
+
void init(const SkPoint pts[], SkPath::Verb verb) {
fPts = pts;
fVerb = verb;
@@ -2065,7 +2065,7 @@
SkScalar leftMost(int start, int end) const {
return (*SegmentLeftMost[fVerb])(fPts, fTs[start].fT, fTs[end].fT);
}
-
+
// this span is excluded by the winding rule -- chase the ends
// as long as they are unambiguous to mark connections as done
// and give them the same winding value
@@ -2077,7 +2077,7 @@
markDone(SkMin32(index, endIndex), winding);
return last;
}
-
+
Span* markAndChaseWinding(const Angle* angle, int winding) {
int index = angle->start();
int endIndex = angle->end();
@@ -2087,11 +2087,11 @@
markWinding(min, winding);
return last;
}
-
+
// FIXME: this should also mark spans with equal (x,y)
// This may be called when the segment is already marked done. While this
// wastes time, it shouldn't do any more than spin through the T spans.
- // OPTIMIZATION: abort on first done found (assuming that this code is
+ // OPTIMIZATION: abort on first done found (assuming that this code is
// always called to mark segments done).
void markDone(int index, int winding) {
// SkASSERT(!done());
@@ -2105,7 +2105,7 @@
markOneDone(__FUNCTION__, index, winding);
} while (++index < fTs.count() && fTs[index].fT - referenceT < FLT_EPSILON);
}
-
+
void markOneDone(const char* funName, int tIndex, int winding) {
Span* span = markOneWinding(funName, tIndex, winding);
if (!span) {
@@ -2114,7 +2114,7 @@
span->fDone = true;
fDoneSpans++;
}
-
+
Span* markOneWinding(const char* funName, int tIndex, int winding) {
Span& span = fTs[tIndex];
if (span.fDone) {
@@ -2216,7 +2216,7 @@
const Span& span(int tIndex) const {
return fTs[tIndex];
}
-
+
int spanSign(int startIndex, int endIndex) const {
int result = startIndex < endIndex ? -fTs[startIndex].fWindValue :
fTs[endIndex].fWindValue;
@@ -2235,7 +2235,7 @@
double t(int tIndex) const {
return fTs[tIndex].fT;
}
-
+
static void TrackOutside(SkTDArray<double>& outsideTs, double end,
double start) {
int outCount = outsideTs.count();
@@ -2244,7 +2244,7 @@
*outsideTs.append() = start;
}
}
-
+
void undoneSpan(int& start, int& end) {
size_t tCount = fTs.count();
size_t index;
@@ -2273,7 +2273,7 @@
int windSum(int tIndex) const {
return fTs[tIndex].fWindSum;
}
-
+
int windSum(const Angle* angle) const {
int start = angle->start();
int end = angle->end();
@@ -2284,7 +2284,7 @@
int windValue(int tIndex) const {
return fTs[tIndex].fWindValue;
}
-
+
int windValue(const Angle* angle) const {
int start = angle->start();
int end = angle->end();
@@ -2312,7 +2312,7 @@
}
return span->fPt;
}
-
+
SkScalar yAtT(int index) const {
return yAtT(&fTs[index]);
}
@@ -2402,7 +2402,7 @@
SkDebugf(" %1.9g,%1.9g", fPts[vIndex].fX, fPts[vIndex].fY);
}
const Span* span = &fTs[i];
- SkDebugf(") t=%1.9g (%1.9g,%1.9g)", fTs[i].fT,
+ SkDebugf(") t=%1.9g (%1.9g,%1.9g)", fTs[i].fT,
xAtT(span), yAtT(span));
const Segment* other = fTs[i].fOther;
SkDebugf(" other=%d otherT=%1.9g otherIndex=%d windSum=",
@@ -2562,7 +2562,7 @@
fSegments.push_back().addLine(pts);
return fSegments.count();
}
-
+
void addOtherT(int segIndex, int tIndex, double otherT, int otherIndex) {
fSegments[segIndex].addOtherT(tIndex, otherT, otherIndex);
}
@@ -2581,7 +2581,7 @@
const Bounds& bounds() const {
return fBounds;
}
-
+
void complete() {
setBounds();
fContainsIntercepts = false;
@@ -2591,7 +2591,7 @@
fContainsIntercepts = true;
}
- const Segment* crossedSegment(const SkPoint& basePt, SkScalar& bestY,
+ const Segment* crossedSegment(const SkPoint& basePt, SkScalar& bestY,
int &tIndex, double& hitT) {
int segmentCount = fSegments.count();
const Segment* bestSegment = NULL;
@@ -2631,7 +2631,7 @@
}
return bestSegment;
}
-
+
bool crosses(const Contour* crosser) const {
for (int index = 0; index < fCrosses.count(); ++index) {
if (fCrosses[index] == crosser) {
@@ -2715,14 +2715,14 @@
#endif
}
}
-
+
const SkTArray<Segment>& segments() {
return fSegments;
}
-
+
// OPTIMIZATION: feel pretty uneasy about this. It seems like once again
// we need to sort and walk edges in y, but that on the surface opens the
- // same can of worms as before. But then, this is a rough sort based on
+ // same can of worms as before. But then, this is a rough sort based on
// segments' top, and not a true sort, so it could be ameniable to regular
// sorting instead of linear searching. Still feel like I'm missing something
Segment* topSegment(SkScalar& bestY) {
@@ -2905,13 +2905,13 @@
}
break;
case SkPath::kQuad_Verb:
-
+
reducedVerb = QuadReduceOrder(&pointsPtr[-1], fReducePts);
if (reducedVerb == 0) {
break; // skip degenerate points
}
if (reducedVerb == 1) {
- *fExtra.append() =
+ *fExtra.append() =
fCurrentContour->addLine(fReducePts.end() - 2);
break;
}
@@ -2995,7 +2995,7 @@
kQuad_Segment = SkPath::kQuad_Verb,
kCubic_Segment = SkPath::kCubic_Verb,
};
-
+
void addCoincident(Work& other, const Intersections& ts, bool swap) {
fContour->addCoincident(fIndex, other.fContour, other.fIndex, ts, swap);
}
@@ -3026,7 +3026,7 @@
const Bounds& bounds() const {
return fContour->segments()[fIndex].bounds();
}
-
+
const SkPoint* cubic() const {
return fCubic;
}
@@ -3036,7 +3036,7 @@
fIndex = 0;
fLast = contour->segments().count();
}
-
+
bool isAdjacent(const Work& next) {
return fContour == next.fContour && fIndex + 1 == next.fIndex;
}
@@ -3431,13 +3431,13 @@
}
test->buildAngles(tIndex, angles);
SkTDArray<Angle*> sorted;
- // OPTIMIZATION: call a sort that, if base point is the leftmost,
+ // OPTIMIZATION: call a sort that, if base point is the leftmost,
// returns the first counterclockwise hour before 6 o'clock,
- // or if the base point is rightmost, returns the first clockwise
+ // or if the base point is rightmost, returns the first clockwise
// hour after 6 o'clock
sortAngles(angles, sorted);
#if DEBUG_SORT
- sorted[0]->segment()->debugShowSort(__FUNCTION__, sorted, 0, 0);
+ sorted[0]->segment()->debugShowSort(__FUNCTION__, sorted, 0, 0);
#endif
// walk the sorted angle fan to find the lowest angle
// above the base point. Currently, the first angle in the sorted array
@@ -3517,10 +3517,10 @@
// we're broken because we find a vertical span
return winding;
}
-
+
// OPTIMIZATION: not crazy about linear search here to find top active y.
// seems like we should break down and do the sort, or maybe sort each
-// contours' segments?
+// contours' segments?
// Once the segment array is built, there's no reason I can think of not to
// sort it in Y. hmmm
// FIXME: return the contour found to pass to inner contour check
@@ -3590,7 +3590,7 @@
SkTDArray<Angle*> sorted;
sortAngles(angles, sorted);
#if DEBUG_SORT
- sorted[0]->segment()->debugShowSort(__FUNCTION__, sorted, 0, 0);
+ sorted[0]->segment()->debugShowSort(__FUNCTION__, sorted, 0, 0);
#endif
// find first angle, initialize winding to computed fWindSum
int firstIndex = -1;
@@ -3611,7 +3611,7 @@
winding += spanWinding;
}
#if DEBUG_SORT
- segment->debugShowSort(__FUNCTION__, sorted, firstIndex, winding);
+ segment->debugShowSort(__FUNCTION__, sorted, firstIndex, winding);
#endif
// we care about first sign and whether wind sum indicates this
// edge is inside or outside. Maybe need to pass span winding
@@ -3679,7 +3679,7 @@
// when winding should follow the intersection direction. If more than one edge
// is an option, choose first edge that continues the inside.
// since we start with leftmost top edge, we'll traverse through a
- // smaller angle counterclockwise to get to the next edge.
+ // smaller angle counterclockwise to get to the next edge.
static void bridgeWinding(SkTDArray<Contour*>& contourList, SkPath& simple) {
bool firstContour = true;
do {
@@ -3713,7 +3713,7 @@
}
#if DEBUG_WINDING
SkDebugf("%s sumWinding=%d spanWinding=%d sign=%d inner=%d result=%d\n", __FUNCTION__,
- sumWinding, spanWinding, SkSign32(index - endIndex),
+ sumWinding, spanWinding, SkSign32(index - endIndex),
inner, contourWinding);
#endif
}
@@ -3730,7 +3730,7 @@
// the initial winding should be correctly passed in so that if the
// inner contour is wound the same way, it never finds an accumulated
// winding of zero. Inside 'find next', we need to look for transitions
- // other than zero when resolving sorted angles.
+ // other than zero when resolving sorted angles.
bool active = windingIsActive(winding, spanWinding);
SkTDArray<Span*> chaseArray;
do {
@@ -3826,7 +3826,7 @@
#endif
simple.close();
}
- }
+ }
}
static void fixOtherTIndex(SkTDArray<Contour*>& contourList) {
diff --git a/experimental/Intersection/SimplifyAddIntersectingTs_Test.cpp b/experimental/Intersection/SimplifyAddIntersectingTs_Test.cpp
index f70d2f8..ce85041 100644
--- a/experimental/Intersection/SimplifyAddIntersectingTs_Test.cpp
+++ b/experimental/Intersection/SimplifyAddIntersectingTs_Test.cpp
@@ -92,17 +92,17 @@
// bool c2Intersected = c2.fSegments[0].intersected();
SkDebugf("%s %s (%1.9g,%1.9g %1.9g,%1.9g) %s %s (%1.9g,%1.9g %1.9g,%1.9g)\n",
__FUNCTION__, SimplifyAddIntersectingTsTest::kLVerbStr[c1Type],
- pts1[0].fX, pts1[0].fY,
+ pts1[0].fX, pts1[0].fY,
pts1[c1Type].fX, pts1[c1Type].fY,
c1Intersected ? "intersects" : "does not intersect",
SimplifyAddIntersectingTsTest::kLVerbStr[c2Type],
- pts2[0].fX, pts2[0].fY,
+ pts2[0].fX, pts2[0].fY,
pts2[c2Type].fX, pts2[c2Type].fY);
if (c1Intersected) {
c1.dump();
c2.dump();
}
-#endif
+#endif
}
static const size_t firstO = 6;
diff --git a/experimental/Intersection/SimplifyFindNext_Test.cpp b/experimental/Intersection/SimplifyFindNext_Test.cpp
index 7d33c11..199ba1d 100644
--- a/experimental/Intersection/SimplifyFindNext_Test.cpp
+++ b/experimental/Intersection/SimplifyFindNext_Test.cpp
@@ -4,9 +4,9 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
+
#define DEBUG_TEST 1
-
+
#include "Simplify.h"
namespace SimplifyFindNextTest {
diff --git a/experimental/Intersection/SimplifyNew_Test.cpp b/experimental/Intersection/SimplifyNew_Test.cpp
index 8d6bb50..c862c27 100644
--- a/experimental/Intersection/SimplifyNew_Test.cpp
+++ b/experimental/Intersection/SimplifyNew_Test.cpp
@@ -505,7 +505,7 @@
static void testLine19() {
SkPath path;
path.addRect(0, 0, 12, 12, (SkPath::Direction) 0);
- path.addRect(12, 16, 21, 21, (SkPath::Direction) 0);
+ path.addRect(12, 16, 21, 21, (SkPath::Direction) 0);
testSimplifyx(path);
}
diff --git a/experimental/Intersection/SimplifyRect4x4_Test.cpp b/experimental/Intersection/SimplifyRect4x4_Test.cpp
index 3768da9..cdd43dd 100644
--- a/experimental/Intersection/SimplifyRect4x4_Test.cpp
+++ b/experimental/Intersection/SimplifyRect4x4_Test.cpp
@@ -52,14 +52,14 @@
break;
case 2:
l = aXAlign * 12;
- r = l + 30;
+ r = l + 30;
t = 0; b = 60;
aYAlign = 5;
break;
case 3:
l = 0; r = 60;
t = aYAlign * 12;
- b = l + 30;
+ b = l + 30;
aXAlign = 5;
break;
}
@@ -74,20 +74,20 @@
switch (bShape) {
case 1: // square
l = bXAlign * 10;
- r = l + 20;
+ r = l + 20;
t = bYAlign * 10;
- b = l + 20;
+ b = l + 20;
break;
case 2:
l = bXAlign * 10;
- r = l + 20;
+ r = l + 20;
t = 10; b = 40;
bYAlign = 5;
break;
case 3:
l = 10; r = 40;
t = bYAlign * 10;
- b = l + 20;
+ b = l + 20;
bXAlign = 5;
break;
}
@@ -102,20 +102,20 @@
switch (cShape) {
case 1: // square
l = cXAlign * 6;
- r = l + 12;
+ r = l + 12;
t = cYAlign * 6;
- b = l + 12;
+ b = l + 12;
break;
case 2:
l = cXAlign * 6;
- r = l + 12;
+ r = l + 12;
t = 20; b = 30;
cYAlign = 5;
break;
case 3:
l = 20; r = 30;
t = cYAlign * 6;
- b = l + 20;
+ b = l + 20;
cXAlign = 5;
break;
}
@@ -130,20 +130,20 @@
switch (dShape) {
case 1: // square
l = dXAlign * 4;
- r = l + 9;
+ r = l + 9;
t = dYAlign * 4;
- b = l + 9;
+ b = l + 9;
break;
case 2:
l = dXAlign * 6;
- r = l + 9;
+ r = l + 9;
t = 32; b = 36;
dYAlign = 5;
break;
case 3:
l = 32; r = 36;
t = dYAlign * 6;
- b = l + 9;
+ b = l + 9;
dXAlign = 5;
break;
}
@@ -186,7 +186,7 @@
for (int a = 0; a < 8; ++a) { // outermost
for (int b = a ; b < 8; ++b) {
for (int c = b ; c < 8; ++c) {
- for (int d = c; d < 8; ++d) {
+ for (int d = c; d < 8; ++d) {
testsRun += dispatchTest4(testSimplify4x4RectsMain, a, b, c, d);
}
if (!gRunTestsInOneThread) SkDebugf(".");
diff --git a/experimental/Intersection/SkAntiEdge.cpp b/experimental/Intersection/SkAntiEdge.cpp
index 7e22588..5aa134c 100644
--- a/experimental/Intersection/SkAntiEdge.cpp
+++ b/experimental/Intersection/SkAntiEdge.cpp
@@ -41,7 +41,7 @@
fLastY = SkScalarToFixed(p1.fY);
if (fFirstY == fLastY) {
return false;
- }
+ }
fFirstX = SkScalarToFixed(p0.fX);
fLastX = SkScalarToFixed(p1.fX);
if (fFirstY > fLastY) {
@@ -190,7 +190,7 @@
SkFixed yDiff = wy - fY;
SkAssertResult(yDiff >= 0);
SkAssertResult(yDiff <= SK_Fixed1);
- int xCoverage = xDiff >> 1; // throw away 1 bit so multiply
+ int xCoverage = xDiff >> 1; // throw away 1 bit so multiply
int yCoverage = yDiff >> 1; // stays in range
int triangle = xCoverage * yCoverage >> 15;
coverage = partial - 1 - triangle;
@@ -271,7 +271,7 @@
SkFixed yDiff = fY - wy;
SkAssertResult(yDiff >= 0);
SkAssertResult(yDiff <= SK_Fixed1);
- int xCoverage = xDiff >> 1; // throw away 1 bit so multiply
+ int xCoverage = xDiff >> 1; // throw away 1 bit so multiply
int yCoverage = yDiff >> 1; // stays in range
int triangle = xCoverage * yCoverage >> 15;
coverage = partial - 1 - triangle;
@@ -384,7 +384,7 @@
valuea = edgea->fFirstX;
valueb = edgeb->fFirstX;
}
-
+
if (valuea == valueb) {
valuea = edgea->fDX;
valueb = edgeb->fDX;
@@ -666,7 +666,7 @@
}
uint8_t old = *resultPtr;
uint8_t pix = coverage_to_8(coverage);
- uint8_t blend = old > pix ? old : pix;
+ uint8_t blend = old > pix ? old : pix;
*resultPtr++ = blend;
++x;
} while (!finished);