@@ -2984,19 +2984,19 @@ public static boolean isInsideEvenOdd(int cross) {
29842984 public static class QuadCurve {
29852985
29862986 double ax , ay , bx , by ;
2987- double Ax , Ay , Bx , By ;
2987+ double axCoeff , ayCoeff , bxCoeff , byCoeff ;
29882988
29892989 public QuadCurve (double x1 , double y1 , double cx , double cy , double x2 , double y2 ) {
29902990 ax = x2 - x1 ;
29912991 ay = y2 - y1 ;
29922992 bx = cx - x1 ;
29932993 by = cy - y1 ;
29942994
2995- Bx = bx + bx ; // Bx = 2.0 * bx
2996- Ax = ax - Bx ; // Ax = ax - 2.0 * bx
2995+ bxCoeff = bx + bx ; // Bx = 2.0 * bx
2996+ axCoeff = ax - bxCoeff ; // Ax = ax - 2.0 * bx
29972997
2998- By = by + by ; // By = 2.0 * by
2999- Ay = ay - By ; // Ay = ay - 2.0 * by
2998+ byCoeff = by + by ; // By = 2.0 * by
2999+ ayCoeff = ay - byCoeff ; // Ay = ay - 2.0 * by
30003000 }
30013001
30023002 int cross (double [] res , int rc , double py1 , double py2 ) {
@@ -3024,10 +3024,10 @@ int cross(double[] res, int rc, double py1, double py2) {
30243024 continue ;
30253025 }
30263026 // CURVE-INSIDE
3027- double ry = t * (t * Ay + By );
3027+ double ry = t * (t * ayCoeff + byCoeff );
30283028 // ry = t * t * Ay + t * By
30293029 if (ry > py2 ) {
3030- double rxt = t * Ax + bx ;
3030+ double rxt = t * axCoeff + bx ;
30313031 // rxt = 2.0 * t * Ax + Bx = 2.0 * t * Ax + 2.0 * bx
30323032 if (rxt > -DELTA && rxt < DELTA ) {
30333033 continue ;
@@ -3040,17 +3040,17 @@ int cross(double[] res, int rc, double py1, double py2) {
30403040 }
30413041
30423042 int solvePoint (double [] res , double px ) {
3043- double [] eqn = {-px , Bx , Ax };
3043+ double [] eqn = {-px , bxCoeff , axCoeff };
30443044 return solveQuad (eqn , res );
30453045 }
30463046
30473047 int solveExtrem (double [] res ) {
30483048 int rc = 0 ;
3049- if (!isZero (Ax )) {
3050- res [rc ++] = -Bx / (Ax + Ax );
3049+ if (!isZero (axCoeff )) {
3050+ res [rc ++] = -bxCoeff / (axCoeff + axCoeff );
30513051 }
3052- if (!isZero (Ay )) {
3053- res [rc ++] = -By / (Ay + Ay );
3052+ if (!isZero (ayCoeff )) {
3053+ res [rc ++] = -byCoeff / (ayCoeff + ayCoeff );
30543054 }
30553055 return rc ;
30563056 }
@@ -3059,11 +3059,11 @@ int addBound(double[] bound, int bc, double[] res, int rc, double minX, double m
30593059 for (int i = 0 ; i < rc ; i ++) {
30603060 double t = res [i ];
30613061 if (t > -DELTA && t < 1 + DELTA ) {
3062- double rx = t * (t * Ax + Bx );
3062+ double rx = t * (t * axCoeff + bxCoeff );
30633063 if (minX <= rx && rx <= maxX ) {
30643064 bound [bc ++] = t ;
30653065 bound [bc ++] = rx ;
3066- bound [bc ++] = t * (t * Ay + By );
3066+ bound [bc ++] = t * (t * ayCoeff + byCoeff );
30673067 bound [bc ++] = id ;
30683068 if (changeId ) {
30693069 id ++;
@@ -3082,8 +3082,8 @@ int addBound(double[] bound, int bc, double[] res, int rc, double minX, double m
30823082 public static class CubicCurve {
30833083
30843084 double ax , ay , bx , by , cx , cy ;
3085- double Ax , Ay , Bx , By , Cx , Cy ;
3086- double Ax3 , Bx2 ;
3085+ double axCoeff , ayCoeff , bxCoeff , byCoeff , cxCoeff , cyCoeff ;
3086+ double axCoeff3 , bxCoeff2 ;
30873087
30883088 public CubicCurve (double x1 , double y1 , double cx1 , double cy1 , double cx2 , double cy2 , double x2 , double y2 ) {
30893089 ax = x2 - x1 ;
@@ -3093,16 +3093,16 @@ public CubicCurve(double x1, double y1, double cx1, double cy1, double cx2, doub
30933093 cx = cx2 - x1 ;
30943094 cy = cy2 - y1 ;
30953095
3096- Cx = bx + bx + bx ; // Cx = 3.0 * bx
3097- Bx = cx + cx + cx - Cx - Cx ; // Bx = 3.0 * cx - 6.0 * bx
3098- Ax = ax - Bx - Cx ; // Ax = ax - 3.0 * cx + 3.0 * bx
3096+ cxCoeff = bx + bx + bx ; // Cx = 3.0 * bx
3097+ bxCoeff = cx + cx + cx - cxCoeff - cxCoeff ; // Bx = 3.0 * cx - 6.0 * bx
3098+ axCoeff = ax - bxCoeff - cxCoeff ; // Ax = ax - 3.0 * cx + 3.0 * bx
30993099
3100- Cy = by + by + by ; // Cy = 3.0 * by
3101- By = cy + cy + cy - Cy - Cy ; // By = 3.0 * cy - 6.0 * by
3102- Ay = ay - By - Cy ; // Ay = ay - 3.0 * cy + 3.0 * by
3100+ cyCoeff = by + by + by ; // Cy = 3.0 * by
3101+ byCoeff = cy + cy + cy - cyCoeff - cyCoeff ; // By = 3.0 * cy - 6.0 * by
3102+ ayCoeff = ay - byCoeff - cyCoeff ; // Ay = ay - 3.0 * cy + 3.0 * by
31033103
3104- Ax3 = Ax + Ax + Ax ;
3105- Bx2 = Bx + Bx ;
3104+ axCoeff3 = axCoeff + axCoeff + axCoeff ;
3105+ bxCoeff2 = bxCoeff + bxCoeff ;
31063106 }
31073107
31083108 int cross (double [] res , int rc , double py1 , double py2 ) {
@@ -3129,13 +3129,13 @@ int cross(double[] res, int rc, double py1, double py2) {
31293129 continue ;
31303130 }
31313131 // CURVE-INSIDE
3132- double ry = t * (t * (t * Ay + By ) + Cy );
3132+ double ry = t * (t * (t * ayCoeff + byCoeff ) + cyCoeff );
31333133 // ry = t * t * t * Ay + t * t * By + t * Cy
31343134 if (ry > py2 ) {
3135- double rxt = t * (t * Ax3 + Bx2 ) + Cx ;
3135+ double rxt = t * (t * axCoeff3 + bxCoeff2 ) + cxCoeff ;
31363136 // rxt = 3.0 * t * t * Ax + 2.0 * t * Bx + Cx
31373137 if (rxt > -DELTA && rxt < DELTA ) {
3138- rxt = t * (Ax3 + Ax3 ) + Bx2 ;
3138+ rxt = t * (axCoeff3 + axCoeff3 ) + bxCoeff2 ;
31393139 // rxt = 6.0 * t * Ax + 2.0 * Bx
31403140 if (rxt < -DELTA || rxt > DELTA ) {
31413141 // Inflection point
@@ -3151,29 +3151,29 @@ int cross(double[] res, int rc, double py1, double py2) {
31513151 }
31523152
31533153 int solvePoint (double [] res , double px ) {
3154- double [] eqn = {-px , Cx , Bx , Ax };
3154+ double [] eqn = {-px , cxCoeff , bxCoeff , axCoeff };
31553155 return solveCubic (eqn , res );
31563156 }
31573157
31583158 int solveExtremX (double [] res ) {
3159- double [] eqn = {Cx , Bx2 , Ax3 };
3159+ double [] eqn = {cxCoeff , bxCoeff2 , axCoeff3 };
31603160 return solveQuad (eqn , res );
31613161 }
31623162
31633163 int solveExtremY (double [] res ) {
3164- double [] eqn = {Cy , By + By , Ay + Ay + Ay };
3164+ double [] eqn = {cyCoeff , byCoeff + byCoeff , ayCoeff + ayCoeff + ayCoeff };
31653165 return solveQuad (eqn , res );
31663166 }
31673167
31683168 int addBound (double [] bound , int bc , double [] res , int rc , double minX , double maxX , boolean changeId , int id ) {
31693169 for (int i = 0 ; i < rc ; i ++) {
31703170 double t = res [i ];
31713171 if (t > -DELTA && t < 1 + DELTA ) {
3172- double rx = t * (t * (t * Ax + Bx ) + Cx );
3172+ double rx = t * (t * (t * axCoeff + bxCoeff ) + cxCoeff );
31733173 if (minX <= rx && rx <= maxX ) {
31743174 bound [bc ++] = t ;
31753175 bound [bc ++] = rx ;
3176- bound [bc ++] = t * (t * (t * Ay + By ) + Cy );
3176+ bound [bc ++] = t * (t * (t * ayCoeff + byCoeff ) + cyCoeff );
31773177 bound [bc ++] = id ;
31783178 if (changeId ) {
31793179 id ++;
0 commit comments