summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/graph/geom/plane
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-07-03 16:21:36 +0200
committerSven Gothel <[email protected]>2014-07-03 16:21:36 +0200
commit556d92b63555a085b25e32b1cd55afce24edd07a (patch)
tree6be2b02c62a77d5aba81ffbe34c46960608be163 /src/jogl/classes/jogamp/graph/geom/plane
parenta90f4a51dffec3247278e3c683ed4462b1dd9ab5 (diff)
Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74)
- Change non static accesses to static members using declaring type - Change indirect accesses to static members to direct accesses (accesses through subtypes) - Add final modifier to private fields - Add final modifier to method parameters - Add final modifier to local variables - Remove unnecessary casts - Remove unnecessary '$NON-NLS$' tags - Remove trailing white spaces on all lines
Diffstat (limited to 'src/jogl/classes/jogamp/graph/geom/plane')
-rw-r--r--src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java70
-rw-r--r--src/jogl/classes/jogamp/graph/geom/plane/Crossing.java206
-rw-r--r--src/jogl/classes/jogamp/graph/geom/plane/IllegalPathStateException.java2
-rw-r--r--src/jogl/classes/jogamp/graph/geom/plane/NoninvertibleTransformException.java2
-rw-r--r--src/jogl/classes/jogamp/graph/geom/plane/Path2D.java76
5 files changed, 178 insertions, 178 deletions
diff --git a/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java b/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java
index 2a30fa6ec..909240c76 100644
--- a/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java
+++ b/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java
@@ -69,7 +69,7 @@ public class AffineTransform implements Cloneable {
setToIdentity();
}
- public AffineTransform(AffineTransform t) {
+ public AffineTransform(final AffineTransform t) {
this.type = t.type;
this.m00 = t.m00;
this.m10 = t.m10;
@@ -79,7 +79,7 @@ public class AffineTransform implements Cloneable {
this.m12 = t.m12;
}
- public AffineTransform(float m00, float m10, float m01, float m11, float m02, float m12) {
+ public AffineTransform(final float m00, final float m10, final float m01, final float m11, final float m02, final float m12) {
this.type = TYPE_UNKNOWN;
this.m00 = m00;
this.m10 = m10;
@@ -89,7 +89,7 @@ public class AffineTransform implements Cloneable {
this.m12 = m12;
}
- public AffineTransform(float[] matrix) {
+ public AffineTransform(final float[] matrix) {
this.type = TYPE_UNKNOWN;
m00 = matrix[0];
m10 = matrix[1];
@@ -144,8 +144,8 @@ public class AffineTransform implements Cloneable {
type |= TYPE_FLIP;
}
- float dx = m00 * m00 + m10 * m10;
- float dy = m01 * m01 + m11 * m11;
+ final float dx = m00 * m00 + m10 * m10;
+ final float dy = m01 * m01 + m11 * m11;
if (dx != dy) {
type |= TYPE_GENERAL_SCALE;
} else
@@ -193,7 +193,7 @@ public class AffineTransform implements Cloneable {
return getType() == TYPE_IDENTITY;
}
- public final void getMatrix(float[] matrix) {
+ public final void getMatrix(final float[] matrix) {
matrix[0] = m00;
matrix[1] = m10;
matrix[2] = m01;
@@ -208,7 +208,7 @@ public class AffineTransform implements Cloneable {
return m00 * m11 - m01 * m10;
}
- public final AffineTransform setTransform(float m00, float m10, float m01, float m11, float m02, float m12) {
+ public final AffineTransform setTransform(final float m00, final float m10, final float m01, final float m11, final float m02, final float m12) {
this.type = TYPE_UNKNOWN;
this.m00 = m00;
this.m10 = m10;
@@ -219,7 +219,7 @@ public class AffineTransform implements Cloneable {
return this;
}
- public final AffineTransform setTransform(AffineTransform t) {
+ public final AffineTransform setTransform(final AffineTransform t) {
type = t.type;
setTransform(t.m00, t.m10, t.m01, t.m11, t.m02, t.m12);
return this;
@@ -232,7 +232,7 @@ public class AffineTransform implements Cloneable {
return this;
}
- public final AffineTransform setToTranslation(float mx, float my) {
+ public final AffineTransform setToTranslation(final float mx, final float my) {
m00 = m11 = 1.0f;
m01 = m10 = 0.0f;
m02 = mx;
@@ -245,7 +245,7 @@ public class AffineTransform implements Cloneable {
return this;
}
- public final AffineTransform setToScale(float scx, float scy) {
+ public final AffineTransform setToScale(final float scx, final float scy) {
m00 = scx;
m11 = scy;
m10 = m01 = m02 = m12 = 0.0f;
@@ -257,7 +257,7 @@ public class AffineTransform implements Cloneable {
return this;
}
- public final AffineTransform setToShear(float shx, float shy) {
+ public final AffineTransform setToShear(final float shx, final float shy) {
m00 = m11 = 1.0f;
m02 = m12 = 0.0f;
m01 = shx;
@@ -270,7 +270,7 @@ public class AffineTransform implements Cloneable {
return this;
}
- public final AffineTransform setToRotation(float angle) {
+ public final AffineTransform setToRotation(final float angle) {
float sin = FloatUtil.sin(angle);
float cos = FloatUtil.cos(angle);
if (FloatUtil.abs(cos) < ZERO) {
@@ -289,7 +289,7 @@ public class AffineTransform implements Cloneable {
return this;
}
- public final AffineTransform setToRotation(float angle, float px, float py) {
+ public final AffineTransform setToRotation(final float angle, final float px, final float py) {
setToRotation(angle);
m02 = px * (1.0f - m00) + py * m10;
m12 = py * (1.0f - m00) - px * m10;
@@ -297,23 +297,23 @@ public class AffineTransform implements Cloneable {
return this;
}
- public final AffineTransform translate(float mx, float my, AffineTransform tmp) {
+ public final AffineTransform translate(final float mx, final float my, final AffineTransform tmp) {
return concatenate(tmp.setToTranslation(mx, my));
}
- public final AffineTransform scale(float scx, float scy, AffineTransform tmp) {
+ public final AffineTransform scale(final float scx, final float scy, final AffineTransform tmp) {
return concatenate(tmp.setToScale(scx, scy));
}
- public final AffineTransform shear(float shx, float shy, AffineTransform tmp) {
+ public final AffineTransform shear(final float shx, final float shy, final AffineTransform tmp) {
return concatenate(tmp.setToShear(shx, shy));
}
- public final AffineTransform rotate(float angle, AffineTransform tmp) {
+ public final AffineTransform rotate(final float angle, final AffineTransform tmp) {
return concatenate(tmp.setToRotation(angle));
}
- public final AffineTransform rotate(float angle, float px, float py, AffineTransform tmp) {
+ public final AffineTransform rotate(final float angle, final float px, final float py, final AffineTransform tmp) {
return concatenate(tmp.setToRotation(angle, px, py));
}
@@ -345,7 +345,7 @@ public class AffineTransform implements Cloneable {
* @param tR the right-argument of the matrix multiplication
* @return this transform for chaining
*/
- public final AffineTransform concatenate(AffineTransform tR) {
+ public final AffineTransform concatenate(final AffineTransform tR) {
// setTransform(multiply(this, tR));
type = TYPE_UNKNOWN;
setTransform(
@@ -369,7 +369,7 @@ public class AffineTransform implements Cloneable {
* @param tL the left-argument of the matrix multiplication
* @return this transform for chaining
*/
- public final AffineTransform preConcatenate(AffineTransform tL) {
+ public final AffineTransform preConcatenate(final AffineTransform tL) {
// setTransform(multiply(tL, this));
type = TYPE_UNKNOWN;
setTransform(
@@ -383,7 +383,7 @@ public class AffineTransform implements Cloneable {
}
public final AffineTransform createInverse() throws NoninvertibleTransformException {
- float det = getDeterminant();
+ final float det = getDeterminant();
if (FloatUtil.abs(det) < ZERO) {
throw new NoninvertibleTransformException(determinantIsZero);
}
@@ -425,8 +425,8 @@ public class AffineTransform implements Cloneable {
public final void transform(final Vertex[] src, int srcOff, final Vertex[] dst, int dstOff, int length) {
while (--length >= 0) {
- Vertex srcPoint = src[srcOff++];
- Vertex dstPoint = dst[dstOff];
+ final Vertex srcPoint = src[srcOff++];
+ final Vertex dstPoint = dst[dstOff];
if (dstPoint == null) {
throw new IllegalArgumentException("dst["+dstOff+"] is null");
}
@@ -489,8 +489,8 @@ public class AffineTransform implements Cloneable {
public final void deltaTransform(final float[] src, int srcOff, final float[] dst, int dstOff, int length) {
while (--length >= 0) {
- float x = src[srcOff++];
- float y = src[srcOff++];
+ final float x = src[srcOff++];
+ final float y = src[srcOff++];
dst[dstOff++] = x * m00 + y * m01;
dst[dstOff++] = x * m10 + y * m11;
}
@@ -504,7 +504,7 @@ public class AffineTransform implements Cloneable {
* @throws NoninvertibleTransformException
*/
public final Vertex inverseTransform(final Vertex src, final Vertex dst) throws NoninvertibleTransformException {
- float det = getDeterminant();
+ final float det = getDeterminant();
if (FloatUtil.abs(det) < ZERO) {
throw new NoninvertibleTransformException(determinantIsZero);
}
@@ -517,28 +517,28 @@ public class AffineTransform implements Cloneable {
public final void inverseTransform(final float[] src, int srcOff, final float[] dst, int dstOff, int length)
throws NoninvertibleTransformException
{
- float det = getDeterminant();
+ final float det = getDeterminant();
if (FloatUtil.abs(det) < ZERO) {
throw new NoninvertibleTransformException(determinantIsZero);
}
while (--length >= 0) {
- float x = src[srcOff++] - m02;
- float y = src[srcOff++] - m12;
+ final float x = src[srcOff++] - m02;
+ final float y = src[srcOff++] - m12;
dst[dstOff++] = (x * m11 - y * m01) / det;
dst[dstOff++] = (y * m00 - x * m10) / det;
}
}
- public final Path2D createTransformedShape(Path2D src) {
+ public final Path2D createTransformedShape(final Path2D src) {
if (src == null) {
return null;
}
if (src instanceof Path2D) {
return src.createTransformedShape(this);
}
- PathIterator path = src.iterator(this);
- Path2D dst = new Path2D(path.getWindingRule());
+ final PathIterator path = src.iterator(this);
+ final Path2D dst = new Path2D(path.getWindingRule());
dst.append(path, false);
return dst;
}
@@ -555,7 +555,7 @@ public class AffineTransform implements Cloneable {
public final AffineTransform clone() {
try {
return (AffineTransform) super.clone();
- } catch (CloneNotSupportedException e) {
+ } catch (final CloneNotSupportedException e) {
throw new InternalError();
}
}
@@ -573,12 +573,12 @@ public class AffineTransform implements Cloneable {
} */
@Override
- public final boolean equals(Object obj) {
+ public final boolean equals(final Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof AffineTransform) {
- AffineTransform t = (AffineTransform)obj;
+ final AffineTransform t = (AffineTransform)obj;
return
m00 == t.m00 && m01 == t.m01 &&
m02 == t.m02 && m10 == t.m10 &&
diff --git a/src/jogl/classes/jogamp/graph/geom/plane/Crossing.java b/src/jogl/classes/jogamp/graph/geom/plane/Crossing.java
index 982575b53..f46dd3c94 100644
--- a/src/jogl/classes/jogamp/graph/geom/plane/Crossing.java
+++ b/src/jogl/classes/jogamp/graph/geom/plane/Crossing.java
@@ -51,10 +51,10 @@ public class Crossing {
* @param res - the roots of the equation
* @return a number of roots
*/
- public static int solveQuad(float eqn[], float res[]) {
- float a = eqn[2];
- float b = eqn[1];
- float c = eqn[0];
+ public static int solveQuad(final float eqn[], final float res[]) {
+ final float a = eqn[2];
+ final float b = eqn[1];
+ final float c = eqn[0];
int rc = 0;
if (a == 0.0) {
if (b == 0.0) {
@@ -83,26 +83,26 @@ public class Crossing {
* @param res - the roots of the equation
* @return a number of roots
*/
- public static int solveCubic(float eqn[], float res[]) {
- float d = eqn[3];
+ public static int solveCubic(final float eqn[], final float res[]) {
+ final float d = eqn[3];
if (d == 0) {
return solveQuad(eqn, res);
}
- float a = eqn[2] / d;
- float b = eqn[1] / d;
- float c = eqn[0] / d;
+ final float a = eqn[2] / d;
+ final float b = eqn[1] / d;
+ final float c = eqn[0] / d;
int rc = 0;
- float Q = (a * a - 3.0f * b) / 9.0f;
- float R = (2.0f * a * a * a - 9.0f * a * b + 27.0f * c) / 54.0f;
- float Q3 = Q * Q * Q;
- float R2 = R * R;
- float n = - a / 3.0f;
+ final float Q = (a * a - 3.0f * b) / 9.0f;
+ final float R = (2.0f * a * a * a - 9.0f * a * b + 27.0f * c) / 54.0f;
+ final float Q3 = Q * Q * Q;
+ final float R2 = R * R;
+ final float n = - a / 3.0f;
if (R2 < Q3) {
- float t = FloatUtil.acos(R / FloatUtil.sqrt(Q3)) / 3.0f;
- float p = 2.0f * FloatUtil.PI / 3.0f;
- float m = -2.0f * FloatUtil.sqrt(Q);
+ final float t = FloatUtil.acos(R / FloatUtil.sqrt(Q3)) / 3.0f;
+ final float p = 2.0f * FloatUtil.PI / 3.0f;
+ final float m = -2.0f * FloatUtil.sqrt(Q);
res[rc++] = m * FloatUtil.cos(t) + n;
res[rc++] = m * FloatUtil.cos(t + p) + n;
res[rc++] = m * FloatUtil.cos(t - p) + n;
@@ -116,10 +116,10 @@ public class Crossing {
if (-ROOT_DELTA < A && A < ROOT_DELTA) {
res[rc++] = n;
} else {
- float B = Q / A;
+ final float B = Q / A;
res[rc++] = A + B + n;
// if (R2 == Q3) {
- float delta = R2 - Q3;
+ final float delta = R2 - Q3;
if (-ROOT_DELTA < delta && delta < ROOT_DELTA) {
res[rc++] = - (A + B) / 2.0f + n;
}
@@ -135,7 +135,7 @@ public class Crossing {
* @param rc - the roots count
* @return new roots count
*/
- static int fixRoots(float res[], int rc) {
+ static int fixRoots(final float res[], final int rc) {
int tc = 0;
for(int i = 0; i < rc; i++) {
out: {
@@ -158,7 +158,7 @@ public class Crossing {
float ax, ay, bx, by;
float Ax, Ay, Bx, By;
- public QuadCurve(float x1, float y1, float cx, float cy, float x2, float y2) {
+ public QuadCurve(final float x1, final float y1, final float cx, final float cy, final float x2, final float y2) {
ax = x2 - x1;
ay = y2 - y1;
bx = cx - x1;
@@ -171,11 +171,11 @@ public class Crossing {
Ay = ay - By; // Ay = ay - 2.0 * by
}
- int cross(float res[], int rc, float py1, float py2) {
+ int cross(final float res[], final int rc, final float py1, final float py2) {
int cross = 0;
for (int i = 0; i < rc; i++) {
- float t = res[i];
+ final float t = res[i];
// CURVE-OUTSIDE
if (t < -DELTA || t > 1 + DELTA) {
@@ -196,10 +196,10 @@ public class Crossing {
continue;
}
// CURVE-INSIDE
- float ry = t * (t * Ay + By);
+ final float ry = t * (t * Ay + By);
// ry = t * t * Ay + t * By
if (ry > py2) {
- float rxt = t * Ax + bx;
+ final float rxt = t * Ax + bx;
// rxt = 2.0 * t * Ax + Bx = 2.0 * t * Ax + 2.0 * bx
if (rxt > -DELTA && rxt < DELTA) {
continue;
@@ -211,12 +211,12 @@ public class Crossing {
return cross;
}
- int solvePoint(float res[], float px) {
- float eqn[] = {-px, Bx, Ax};
+ int solvePoint(final float res[], final float px) {
+ final float eqn[] = {-px, Bx, Ax};
return solveQuad(eqn, res);
}
- int solveExtrem(float res[]) {
+ int solveExtrem(final float res[]) {
int rc = 0;
if (Ax != 0.0) {
res[rc++] = - Bx / (Ax + Ax);
@@ -227,11 +227,11 @@ public class Crossing {
return rc;
}
- int addBound(float bound[], int bc, float res[], int rc, float minX, float maxX, boolean changeId, int id) {
+ int addBound(final float bound[], int bc, final float res[], final int rc, final float minX, final float maxX, final boolean changeId, int id) {
for(int i = 0; i < rc; i++) {
- float t = res[i];
+ final float t = res[i];
if (t > -DELTA && t < 1 + DELTA) {
- float rx = t * (t * Ax + Bx);
+ final float rx = t * (t * Ax + Bx);
if (minX <= rx && rx <= maxX) {
bound[bc++] = t;
bound[bc++] = rx;
@@ -257,7 +257,7 @@ public class Crossing {
float Ax, Ay, Bx, By, Cx, Cy;
float Ax3, Bx2;
- public CubicCurve(float x1, float y1, float cx1, float cy1, float cx2, float cy2, float x2, float y2) {
+ public CubicCurve(final float x1, final float y1, final float cx1, final float cy1, final float cx2, final float cy2, final float x2, final float y2) {
ax = x2 - x1;
ay = y2 - y1;
bx = cx1 - x1;
@@ -277,10 +277,10 @@ public class Crossing {
Bx2 = Bx + Bx;
}
- int cross(float res[], int rc, float py1, float py2) {
+ int cross(final float res[], final int rc, final float py1, final float py2) {
int cross = 0;
for (int i = 0; i < rc; i++) {
- float t = res[i];
+ final float t = res[i];
// CURVE-OUTSIDE
if (t < -DELTA || t > 1 + DELTA) {
@@ -301,7 +301,7 @@ public class Crossing {
continue;
}
// CURVE-INSIDE
- float ry = t * (t * (t * Ay + By) + Cy);
+ final float ry = t * (t * (t * Ay + By) + Cy);
// ry = t * t * t * Ay + t * t * By + t * Cy
if (ry > py2) {
float rxt = t * (t * Ax3 + Bx2) + Cx;
@@ -322,26 +322,26 @@ public class Crossing {
return cross;
}
- int solvePoint(float res[], float px) {
- float eqn[] = {-px, Cx, Bx, Ax};
+ int solvePoint(final float res[], final float px) {
+ final float eqn[] = {-px, Cx, Bx, Ax};
return solveCubic(eqn, res);
}
- int solveExtremX(float res[]) {
- float eqn[] = {Cx, Bx2, Ax3};
+ int solveExtremX(final float res[]) {
+ final float eqn[] = {Cx, Bx2, Ax3};
return solveQuad(eqn, res);
}
- int solveExtremY(float res[]) {
- float eqn[] = {Cy, By + By, Ay + Ay + Ay};
+ int solveExtremY(final float res[]) {
+ final float eqn[] = {Cy, By + By, Ay + Ay + Ay};
return solveQuad(eqn, res);
}
- int addBound(float bound[], int bc, float res[], int rc, float minX, float maxX, boolean changeId, int id) {
+ int addBound(final float bound[], int bc, final float res[], final int rc, final float minX, final float maxX, final boolean changeId, int id) {
for(int i = 0; i < rc; i++) {
- float t = res[i];
+ final float t = res[i];
if (t > -DELTA && t < 1 + DELTA) {
- float rx = t * (t * (t * Ax + Bx) + Cx);
+ final float rx = t * (t * (t * Ax + Bx) + Cx);
if (minX <= rx && rx <= maxX) {
bound[bc++] = t;
bound[bc++] = rx;
@@ -361,7 +361,7 @@ public class Crossing {
/**
* Returns how many times ray from point (x,y) cross line.
*/
- public static int crossLine(float x1, float y1, float x2, float y2, float x, float y) {
+ public static int crossLine(final float x1, final float y1, final float x2, final float y2, final float x, final float y) {
// LEFT/RIGHT/UP/EMPTY
if ((x < x1 && x < x2) ||
@@ -399,7 +399,7 @@ public class Crossing {
/**
* Returns how many times ray from point (x,y) cross quard curve
*/
- public static int crossQuad(float x1, float y1, float cx, float cy, float x2, float y2, float x, float y) {
+ public static int crossQuad(final float x1, final float y1, final float cx, final float cy, final float x2, final float y2, final float x, final float y) {
// LEFT/RIGHT/UP/EMPTY
if ((x < x1 && x < cx && x < x2) ||
@@ -419,11 +419,11 @@ public class Crossing {
}
// INSIDE
- QuadCurve c = new QuadCurve(x1, y1, cx, cy, x2, y2);
- float px = x - x1;
- float py = y - y1;
- float res[] = new float[3];
- int rc = c.solvePoint(res, px);
+ final QuadCurve c = new QuadCurve(x1, y1, cx, cy, x2, y2);
+ final float px = x - x1;
+ final float py = y - y1;
+ final float res[] = new float[3];
+ final int rc = c.solvePoint(res, px);
return c.cross(res, rc, py, py);
}
@@ -431,7 +431,7 @@ public class Crossing {
/**
* Returns how many times ray from point (x,y) cross cubic curve
*/
- public static int crossCubic(float x1, float y1, float cx1, float cy1, float cx2, float cy2, float x2, float y2, float x, float y) {
+ public static int crossCubic(final float x1, final float y1, final float cx1, final float cy1, final float cx2, final float cy2, final float x2, final float y2, final float x, final float y) {
// LEFT/RIGHT/UP/EMPTY
if ((x < x1 && x < cx1 && x < cx2 && x < x2) ||
@@ -451,18 +451,18 @@ public class Crossing {
}
// INSIDE
- CubicCurve c = new CubicCurve(x1, y1, cx1, cy1, cx2, cy2, x2, y2);
- float px = x - x1;
- float py = y - y1;
- float res[] = new float[3];
- int rc = c.solvePoint(res, px);
+ final CubicCurve c = new CubicCurve(x1, y1, cx1, cy1, cx2, cy2, x2, y2);
+ final float px = x - x1;
+ final float py = y - y1;
+ final float res[] = new float[3];
+ final int rc = c.solvePoint(res, px);
return c.cross(res, rc, py, py);
}
/**
* Returns how many times ray from point (x,y) cross path
*/
- public static int crossPath(PathIterator p, float x, float y) {
+ public static int crossPath(final PathIterator p, final float x, final float y) {
int cross = 0;
float mx, my, cx, cy;
mx = my = cx = cy = 0.0f;
@@ -513,7 +513,7 @@ public class Crossing {
/**
* Returns how many times ray from point (x,y) cross shape
*/
- public static int crossShape(Path2D s, float x, float y) {
+ public static int crossShape(final Path2D s, final float x, final float y) {
if (!s.getBounds2D().contains(x, y)) {
return 0;
}
@@ -523,14 +523,14 @@ public class Crossing {
/**
* Returns true if value enough small
*/
- public static boolean isZero(float val) {
+ public static boolean isZero(final float val) {
return -DELTA < val && val < DELTA;
}
/**
* Sort bound array
*/
- static void sortBound(float bound[], int bc) {
+ static void sortBound(final float bound[], final int bc) {
for(int i = 0; i < bc - 4; i += 4) {
int k = i;
for(int j = i + 4; j < bc; j += 4) {
@@ -558,7 +558,7 @@ public class Crossing {
/**
* Returns are bounds intersect or not intersect rectangle
*/
- static int crossBound(float bound[], int bc, float py1, float py2) {
+ static int crossBound(final float bound[], final int bc, final float py1, final float py2) {
// LEFT/RIGHT
if (bc == 0) {
@@ -590,7 +590,7 @@ public class Crossing {
sortBound(bound, bc);
boolean sign = bound[2] > py2;
for(int i = 6; i < bc; i += 4) {
- boolean sign2 = bound[i] > py2;
+ final boolean sign2 = bound[i] > py2;
if (sign != sign2 && bound[i + 1] != bound[i - 3]) {
return CROSSING;
}
@@ -603,7 +603,7 @@ public class Crossing {
/**
* Returns how many times rectangle stripe cross line or the are intersect
*/
- public static int intersectLine(float x1, float y1, float x2, float y2, float rx1, float ry1, float rx2, float ry2) {
+ public static int intersectLine(final float x1, final float y1, final float x2, final float y2, final float rx1, final float ry1, final float rx2, final float ry2) {
// LEFT/RIGHT/UP
if ((rx2 < x1 && rx2 < x2) ||
@@ -631,9 +631,9 @@ public class Crossing {
bx1 = x2 < rx1 ? rx1 : x2;
bx2 = x1 < rx2 ? x1 : rx2;
}
- float k = (y2 - y1) / (x2 - x1);
- float by1 = k * (bx1 - x1) + y1;
- float by2 = k * (bx2 - x1) + y1;
+ final float k = (y2 - y1) / (x2 - x1);
+ final float by1 = k * (bx1 - x1) + y1;
+ final float by2 = k * (bx2 - x1) + y1;
// BOUND-UP
if (by1 < ry1 && by2 < ry1) {
@@ -672,7 +672,7 @@ public class Crossing {
/**
* Returns how many times rectangle stripe cross quad curve or the are intersect
*/
- public static int intersectQuad(float x1, float y1, float cx, float cy, float x2, float y2, float rx1, float ry1, float rx2, float ry2) {
+ public static int intersectQuad(final float x1, final float y1, final float cx, final float cy, final float x2, final float y2, final float rx1, final float ry1, final float rx2, final float ry2) {
// LEFT/RIGHT/UP ------------------------------------------------------
if ((rx2 < x1 && rx2 < cx && rx2 < x2) ||
@@ -691,15 +691,15 @@ public class Crossing {
}
// INSIDE -------------------------------------------------------------
- QuadCurve c = new QuadCurve(x1, y1, cx, cy, x2, y2);
- float px1 = rx1 - x1;
- float py1 = ry1 - y1;
- float px2 = rx2 - x1;
- float py2 = ry2 - y1;
-
- float res1[] = new float[3];
- float res2[] = new float[3];
- int rc1 = c.solvePoint(res1, px1);
+ final QuadCurve c = new QuadCurve(x1, y1, cx, cy, x2, y2);
+ final float px1 = rx1 - x1;
+ final float py1 = ry1 - y1;
+ final float px2 = rx2 - x1;
+ final float py2 = ry2 - y1;
+
+ final float res1[] = new float[3];
+ final float res2[] = new float[3];
+ final int rc1 = c.solvePoint(res1, px1);
int rc2 = c.solvePoint(res2, px2);
// INSIDE-LEFT/RIGHT
@@ -708,9 +708,9 @@ public class Crossing {
}
// Build bound --------------------------------------------------------
- float minX = px1 - DELTA;
- float maxX = px2 + DELTA;
- float bound[] = new float[28];
+ final float minX = px1 - DELTA;
+ final float maxX = px2 + DELTA;
+ final float bound[] = new float[28];
int bc = 0;
// Add roots
bc = c.addBound(bound, bc, res1, rc1, minX, maxX, false, 0);
@@ -733,7 +733,7 @@ public class Crossing {
}
// End build bound ----------------------------------------------------
- int cross = crossBound(bound, bc, py1, py2);
+ final int cross = crossBound(bound, bc, py1, py2);
if (cross != UNKNOWN) {
return cross;
}
@@ -743,7 +743,7 @@ public class Crossing {
/**
* Returns how many times rectangle stripe cross cubic curve or the are intersect
*/
- public static int intersectCubic(float x1, float y1, float cx1, float cy1, float cx2, float cy2, float x2, float y2, float rx1, float ry1, float rx2, float ry2) {
+ public static int intersectCubic(final float x1, final float y1, final float cx1, final float cy1, final float cx2, final float cy2, final float x2, final float y2, final float rx1, final float ry1, final float rx2, final float ry2) {
// LEFT/RIGHT/UP
if ((rx2 < x1 && rx2 < cx1 && rx2 < cx2 && rx2 < x2) ||
@@ -762,15 +762,15 @@ public class Crossing {
}
// INSIDE
- CubicCurve c = new CubicCurve(x1, y1, cx1, cy1, cx2, cy2, x2, y2);
- float px1 = rx1 - x1;
- float py1 = ry1 - y1;
- float px2 = rx2 - x1;
- float py2 = ry2 - y1;
-
- float res1[] = new float[3];
- float res2[] = new float[3];
- int rc1 = c.solvePoint(res1, px1);
+ final CubicCurve c = new CubicCurve(x1, y1, cx1, cy1, cx2, cy2, x2, y2);
+ final float px1 = rx1 - x1;
+ final float py1 = ry1 - y1;
+ final float px2 = rx2 - x1;
+ final float py2 = ry2 - y1;
+
+ final float res1[] = new float[3];
+ final float res2[] = new float[3];
+ final int rc1 = c.solvePoint(res1, px1);
int rc2 = c.solvePoint(res2, px2);
// LEFT/RIGHT
@@ -778,11 +778,11 @@ public class Crossing {
return 0;
}
- float minX = px1 - DELTA;
- float maxX = px2 + DELTA;
+ final float minX = px1 - DELTA;
+ final float maxX = px2 + DELTA;
// Build bound --------------------------------------------------------
- float bound[] = new float[40];
+ final float bound[] = new float[40];
int bc = 0;
// Add roots
bc = c.addBound(bound, bc, res1, rc1, minX, maxX, false, 0);
@@ -807,7 +807,7 @@ public class Crossing {
}
// End build bound ----------------------------------------------------
- int cross = crossBound(bound, bc, py1, py2);
+ final int cross = crossBound(bound, bc, py1, py2);
if (cross != UNKNOWN) {
return cross;
}
@@ -817,7 +817,7 @@ public class Crossing {
/**
* Returns how many times rectangle stripe cross path or the are intersect
*/
- public static int intersectPath(PathIterator p, float x, float y, float w, float h) {
+ public static int intersectPath(final PathIterator p, final float x, final float y, final float w, final float h) {
int cross = 0;
int count;
@@ -825,10 +825,10 @@ public class Crossing {
mx = my = cx = cy = 0.0f;
final float coords[] = new float[6];
- float rx1 = x;
- float ry1 = y;
- float rx2 = x + w;
- float ry2 = y + h;
+ final float rx1 = x;
+ final float ry1 = y;
+ final float rx2 = x + w;
+ final float ry2 = y + h;
while (!p.isDone()) {
count = 0;
@@ -879,7 +879,7 @@ public class Crossing {
/**
* Returns how many times rectangle stripe cross shape or the are intersect
*/
- public static int intersectShape(Path2D s, float x, float y, float w, float h) {
+ public static int intersectShape(final Path2D s, final float x, final float y, final float w, final float h) {
if (!s.getBounds2D().intersects2DRegion(x, y, w, h)) {
return 0;
}
@@ -889,14 +889,14 @@ public class Crossing {
/**
* Returns true if cross count correspond inside location for non zero path rule
*/
- public static boolean isInsideNonZero(int cross) {
+ public static boolean isInsideNonZero(final int cross) {
return cross != 0;
}
/**
* Returns true if cross count correspond inside location for even-odd path rule
*/
- public static boolean isInsideEvenOdd(int cross) {
+ public static boolean isInsideEvenOdd(final int cross) {
return (cross & 1) != 0;
}
}
diff --git a/src/jogl/classes/jogamp/graph/geom/plane/IllegalPathStateException.java b/src/jogl/classes/jogamp/graph/geom/plane/IllegalPathStateException.java
index 55211b3f9..2c18e0834 100644
--- a/src/jogl/classes/jogamp/graph/geom/plane/IllegalPathStateException.java
+++ b/src/jogl/classes/jogamp/graph/geom/plane/IllegalPathStateException.java
@@ -26,7 +26,7 @@ public class IllegalPathStateException extends RuntimeException {
public IllegalPathStateException() {
}
- public IllegalPathStateException(String s) {
+ public IllegalPathStateException(final String s) {
super(s);
}
diff --git a/src/jogl/classes/jogamp/graph/geom/plane/NoninvertibleTransformException.java b/src/jogl/classes/jogamp/graph/geom/plane/NoninvertibleTransformException.java
index 398a03fca..6e49607b7 100644
--- a/src/jogl/classes/jogamp/graph/geom/plane/NoninvertibleTransformException.java
+++ b/src/jogl/classes/jogamp/graph/geom/plane/NoninvertibleTransformException.java
@@ -23,7 +23,7 @@ public class NoninvertibleTransformException extends java.lang.Exception {
private static final long serialVersionUID = 6137225240503990466L;
- public NoninvertibleTransformException(String s) {
+ public NoninvertibleTransformException(final String s) {
super(s);
}
diff --git a/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java b/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java
index a87c0a0a1..3b79c28b6 100644
--- a/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java
+++ b/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java
@@ -108,7 +108,7 @@ public final class Path2D implements Cloneable {
* Constructs a new GeneralPath.Iterator for given general path
* @param path - the source GeneralPath object
*/
- Iterator(Path2D path) {
+ Iterator(final Path2D path) {
this(path, null);
}
@@ -117,7 +117,7 @@ public final class Path2D implements Cloneable {
* @param path - the source GeneralPath object
* @param at - the AffineTransform object to apply rectangle path
*/
- Iterator(Path2D path, AffineTransform at) {
+ Iterator(final Path2D path, final AffineTransform at) {
this.p = path;
this.t = at;
}
@@ -138,12 +138,12 @@ public final class Path2D implements Cloneable {
}
@Override
- public int currentSegment(float[] coords) {
+ public int currentSegment(final float[] coords) {
if (isDone()) {
throw new NoSuchElementException(iteratorOutOfBounds);
}
- int type = p.types[typeIndex];
- int count = Path2D.pointShift[type];
+ final int type = p.types[typeIndex];
+ final int count = Path2D.pointShift[type];
System.arraycopy(p.points, pointIndex, coords, 0, count);
if (t != null) {
t.transform(coords, 0, coords, 0, count / 2);
@@ -158,24 +158,24 @@ public final class Path2D implements Cloneable {
this(WIND_NON_ZERO, BUFFER_SIZE);
}
- public Path2D(int rule) {
+ public Path2D(final int rule) {
this(rule, BUFFER_SIZE);
}
- public Path2D(int rule, int initialCapacity) {
+ public Path2D(final int rule, final int initialCapacity) {
setWindingRule(rule);
types = new byte[initialCapacity];
points = new float[initialCapacity * 2];
}
- public Path2D(Path2D path) {
+ public Path2D(final Path2D path) {
this(WIND_NON_ZERO, BUFFER_SIZE);
- PathIterator p = path.iterator(null);
+ final PathIterator p = path.iterator(null);
setWindingRule(p.getWindingRule());
append(p, false);
}
- public void setWindingRule(int rule) {
+ public void setWindingRule(final int rule) {
if (rule != WIND_EVEN_ODD && rule != WIND_NON_ZERO) {
throw new NoSuchElementException(invalidWindingRuleValue);
}
@@ -190,23 +190,23 @@ public final class Path2D implements Cloneable {
* Checks points and types buffer size to add pointCount points. If necessary realloc buffers to enlarge size.
* @param pointCount - the point count to be added in buffer
*/
- void checkBuf(int pointCount, boolean checkMove) {
+ void checkBuf(final int pointCount, final boolean checkMove) {
if (checkMove && typeSize == 0) {
throw new IllegalPathStateException("First segment should be SEG_MOVETO type");
}
if (typeSize == types.length) {
- byte tmp[] = new byte[typeSize + BUFFER_CAPACITY];
+ final byte tmp[] = new byte[typeSize + BUFFER_CAPACITY];
System.arraycopy(types, 0, tmp, 0, typeSize);
types = tmp;
}
if (pointSize + pointCount > points.length) {
- float tmp[] = new float[pointSize + Math.max(BUFFER_CAPACITY * 2, pointCount)];
+ final float tmp[] = new float[pointSize + Math.max(BUFFER_CAPACITY * 2, pointCount)];
System.arraycopy(points, 0, tmp, 0, pointSize);
points = tmp;
}
}
- public void moveTo(float x, float y) {
+ public void moveTo(final float x, final float y) {
if (typeSize > 0 && types[typeSize - 1] == PathIterator.SEG_MOVETO) {
points[pointSize - 2] = x;
points[pointSize - 1] = y;
@@ -218,14 +218,14 @@ public final class Path2D implements Cloneable {
}
}
- public void lineTo(float x, float y) {
+ public void lineTo(final float x, final float y) {
checkBuf(2, true);
types[typeSize++] = PathIterator.SEG_LINETO;
points[pointSize++] = x;
points[pointSize++] = y;
}
- public void quadTo(float x1, float y1, float x2, float y2) {
+ public void quadTo(final float x1, final float y1, final float x2, final float y2) {
checkBuf(4, true);
types[typeSize++] = PathIterator.SEG_QUADTO;
points[pointSize++] = x1;
@@ -234,7 +234,7 @@ public final class Path2D implements Cloneable {
points[pointSize++] = y2;
}
- public void curveTo(float x1, float y1, float x2, float y2, float x3, float y3) {
+ public void curveTo(final float x1, final float y1, final float x2, final float y2, final float x3, final float y3) {
checkBuf(6, true);
types[typeSize++] = PathIterator.SEG_CUBICTO;
points[pointSize++] = x1;
@@ -265,12 +265,12 @@ public final class Path2D implements Cloneable {
return "[size "+size()+", closed "+isClosed()+"]";
}
- public void append(Path2D path, boolean connect) {
- PathIterator p = path.iterator(null);
+ public void append(final Path2D path, final boolean connect) {
+ final PathIterator p = path.iterator(null);
append(p, connect);
}
- public void append(PathIterator path, boolean connect) {
+ public void append(final PathIterator path, boolean connect) {
while (!path.isDone()) {
final float coords[] = new float[6];
final int segmentType = path.currentSegment(coords);
@@ -315,7 +315,7 @@ public final class Path2D implements Cloneable {
if (types[typeSize - 1] == PathIterator.SEG_CLOSE) {
for (int i = typeSize - 2; i > 0; i--) {
- int type = types[i];
+ final int type = types[i];
if (type == PathIterator.SEG_MOVETO) {
break;
}
@@ -330,12 +330,12 @@ public final class Path2D implements Cloneable {
pointSize = 0;
}
- public void transform(AffineTransform t) {
+ public void transform(final AffineTransform t) {
t.transform(points, 0, points, 0, pointSize / 2);
}
- public Path2D createTransformedShape(AffineTransform t) {
- Path2D p = (Path2D)clone();
+ public Path2D createTransformedShape(final AffineTransform t) {
+ final Path2D p = (Path2D)clone();
if (t != null) {
p.transform(t);
}
@@ -351,8 +351,8 @@ public final class Path2D implements Cloneable {
ry1 = ry2 = points[i--];
rx1 = rx2 = points[i--];
while (i > 0) {
- float y = points[i--];
- float x = points[i--];
+ final float y = points[i--];
+ final float x = points[i--];
if (x < rx1) {
rx1 = x;
} else
@@ -375,36 +375,36 @@ public final class Path2D implements Cloneable {
* @param cross - the point cross count
* @return true if point is inside path, or false otherwise
*/
- boolean isInside(int cross) {
+ boolean isInside(final int cross) {
if (rule == WIND_NON_ZERO) {
return Crossing.isInsideNonZero(cross);
}
return Crossing.isInsideEvenOdd(cross);
}
- public boolean contains(float px, float py) {
+ public boolean contains(final float px, final float py) {
return isInside(Crossing.crossShape(this, px, py));
}
- public boolean contains(float rx, float ry, float rw, float rh) {
- int cross = Crossing.intersectShape(this, rx, ry, rw, rh);
+ public boolean contains(final float rx, final float ry, final float rw, final float rh) {
+ final int cross = Crossing.intersectShape(this, rx, ry, rw, rh);
return cross != Crossing.CROSSING && isInside(cross);
}
- public boolean intersects(float rx, float ry, float rw, float rh) {
- int cross = Crossing.intersectShape(this, rx, ry, rw, rh);
+ public boolean intersects(final float rx, final float ry, final float rw, final float rh) {
+ final int cross = Crossing.intersectShape(this, rx, ry, rw, rh);
return cross == Crossing.CROSSING || isInside(cross);
}
- public boolean contains(Vertex p) {
+ public boolean contains(final Vertex p) {
return contains(p.getX(), p.getY());
}
- public boolean contains(AABBox r) {
+ public boolean contains(final AABBox r) {
return contains(r.getMinX(), r.getMinY(), r.getWidth(), r.getHeight());
}
- public boolean intersects(AABBox r) {
+ public boolean intersects(final AABBox r) {
return intersects(r.getMinX(), r.getMinY(), r.getWidth(), r.getHeight());
}
@@ -412,7 +412,7 @@ public final class Path2D implements Cloneable {
return new Iterator(this);
}
- public PathIterator iterator(AffineTransform t) {
+ public PathIterator iterator(final AffineTransform t) {
return new Iterator(this, t);
}
@@ -423,11 +423,11 @@ public final class Path2D implements Cloneable {
@Override
public Object clone() {
try {
- Path2D p = (Path2D) super.clone();
+ final Path2D p = (Path2D) super.clone();
p.types = types.clone();
p.points = points.clone();
return p;
- } catch (CloneNotSupportedException e) {
+ } catch (final CloneNotSupportedException e) {
throw new InternalError();
}
}