aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-03-15 07:02:35 +0100
committerSven Gothel <[email protected]>2014-03-15 07:02:35 +0100
commit0b61e9a2641e38475a330303e49f6becf99158e1 (patch)
tree4d4bd7ead74950ce7df84d184519873bd83bf660 /src/jogl
parente4641e304fbc64a5d185a39c6ca6357cc678e013 (diff)
Bug 801: Remove Vertex.Factory from AffineTransform ; Add AABBox tranformed resize.
Diffstat (limited to 'src/jogl')
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java8
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/Region.java16
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java2
-rw-r--r--src/jogl/classes/com/jogamp/graph/geom/Outline.java8
-rw-r--r--src/jogl/classes/com/jogamp/graph/geom/Triangle.java8
-rw-r--r--src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java72
-rw-r--r--src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java110
7 files changed, 134 insertions, 90 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java b/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java
index 0d3a61fac..63183bf68 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java
@@ -332,7 +332,7 @@ public class OutlineShape implements Comparable<OutlineShape> {
final Outline lo = getLastOutline();
lo.addVertex(v);
if( 0 == ( dirtyBits & DIRTY_BOUNDS ) ) {
- bbox.resize(lo.getBounds());
+ bbox.resize(v.getCoord());
}
// vertices.add(v); // FIXME: can do and remove DIRTY_VERTICES ?
dirtyBits |= DIRTY_TRIANGLES | DIRTY_VERTICES;
@@ -347,7 +347,7 @@ public class OutlineShape implements Comparable<OutlineShape> {
final Outline lo = getLastOutline();
lo.addVertex(position, v);
if( 0 == ( dirtyBits & DIRTY_BOUNDS ) ) {
- bbox.resize(lo.getBounds());
+ bbox.resize(v.getCoord());
}
dirtyBits |= DIRTY_TRIANGLES | DIRTY_VERTICES;
}
@@ -653,11 +653,11 @@ public class OutlineShape implements Comparable<OutlineShape> {
* Note: Triangulated data is lost in returned instance!
* </p>
*/
- public OutlineShape transform(AffineTransform t) {
+ public final OutlineShape transform(final AffineTransform t) {
final OutlineShape newOutlineShape = new OutlineShape(vertexFactory);
final int osize = outlines.size();
for(int i=0; i<osize; i++) {
- newOutlineShape.addOutline( outlines.get(i).transform(t) );
+ newOutlineShape.addOutline( outlines.get(i).transform(t, vertexFactory) );
}
return newOutlineShape;
}
diff --git a/src/jogl/classes/com/jogamp/graph/curve/Region.java b/src/jogl/classes/com/jogamp/graph/curve/Region.java
index 853c837f5..bb0ed09d1 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/Region.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/Region.java
@@ -202,12 +202,12 @@ public abstract class Region {
* The optional {@link AffineTransform} is applied to the bounding-box beforehand.
* </p>
*/
- public final void addOutlineShape(final OutlineShape shape, final AffineTransform transform) {
+ public final void addOutlineShape(final OutlineShape shape, final AffineTransform t) {
if( null != frustum ) {
final AABBox shapeBox = shape.getBounds();
final AABBox shapeBoxT;
- if( null != transform ) {
- transform.transform(shapeBox, tmpBox);
+ if( null != t ) {
+ t.transform(shapeBox, tmpBox);
shapeBoxT = tmpBox;
} else {
shapeBoxT = shapeBox;
@@ -222,7 +222,7 @@ public abstract class Region {
final List<Triangle> trisIn = shape.getTriangles(OutlineShape.VerticesState.QUADRATIC_NURBS);
final ArrayList<Vertex> vertsIn = shape.getVertices();
if(DEBUG_INSTANCE) {
- System.err.println("Region.addOutlineShape().0: tris: "+trisIn.size()+", verts "+vertsIn.size()+", transform "+transform);
+ System.err.println("Region.addOutlineShape().0: tris: "+trisIn.size()+", verts "+vertsIn.size()+", transform "+t);
}
final int idxOffset = numVertices;
int vertsVNewIdxCount = 0, vertsTMovIdxCount = 0, vertsTNewIdxCount = 0, tris = 0;
@@ -232,7 +232,7 @@ public abstract class Region {
System.err.println("Region.addOutlineShape(): Processing Vertices");
}
for(int i=0; i<vertsIn.size(); i++) {
- pushNewVertexImpl(vertsIn.get(i), transform);
+ pushNewVertexImpl(vertsIn.get(i), t);
vertsVNewIdxCount++;
}
if(DEBUG_INSTANCE) {
@@ -261,9 +261,9 @@ public abstract class Region {
if(Region.DEBUG_INSTANCE) {
System.err.println("T["+i+"]: New Idx "+numVertices);
}
- pushNewVertexIdxImpl(triInVertices[0], transform);
- pushNewVertexIdxImpl(triInVertices[1], transform);
- pushNewVertexIdxImpl(triInVertices[2], transform);
+ pushNewVertexIdxImpl(triInVertices[0], t);
+ pushNewVertexIdxImpl(triInVertices[1], t);
+ pushNewVertexIdxImpl(triInVertices[2], t);
vertsTNewIdxCount+=3;
}
tris++;
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java
index 0721c4726..140e03cfb 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java
@@ -128,7 +128,7 @@ public class TextRegionUtil {
public final void visit(final OutlineShape shape, final AffineTransform t) {
region.addOutlineShape(shape, t);
} };
- processString(visitor, new AffineTransform(vertexFactory), font, pixelSize, str);
+ processString(visitor, new AffineTransform(), font, pixelSize, str);
}
/**
diff --git a/src/jogl/classes/com/jogamp/graph/geom/Outline.java b/src/jogl/classes/com/jogamp/graph/geom/Outline.java
index b299524c0..5f6dd028f 100644
--- a/src/jogl/classes/com/jogamp/graph/geom/Outline.java
+++ b/src/jogl/classes/com/jogamp/graph/geom/Outline.java
@@ -87,7 +87,7 @@ public class Outline implements Cloneable, Comparable<Outline> {
}
vertices.add(position, vertex);
if(!dirtyBBox) {
- bbox.resize(vertex.getX(), vertex.getY(), vertex.getZ());
+ bbox.resize(vertex.getCoord());
}
}
@@ -187,12 +187,12 @@ public class Outline implements Cloneable, Comparable<Outline> {
/**
* Return a transformed instance with all vertices are copied and transformed.
*/
- public final Outline transform(AffineTransform t) {
+ public final Outline transform(final AffineTransform t, final Vertex.Factory<? extends Vertex> vertexFactory) {
final Outline newOutline = new Outline();
final int vsize = vertices.size();
for(int i=0; i<vsize; i++) {
final Vertex v = vertices.get(i);
- newOutline.addVertex(t.transform(v, null));
+ newOutline.addVertex(t.transform(v, vertexFactory.create()));
}
newOutline.closed = this.closed;
return newOutline;
@@ -202,7 +202,7 @@ public class Outline implements Cloneable, Comparable<Outline> {
dirtyBBox = false;
bbox.reset();
for (int i=0; i<vertices.size(); i++) {
- bbox.resize(vertices.get(i).getCoord(), 0);
+ bbox.resize(vertices.get(i).getCoord());
}
}
diff --git a/src/jogl/classes/com/jogamp/graph/geom/Triangle.java b/src/jogl/classes/com/jogamp/graph/geom/Triangle.java
index e353dd061..593d9cb24 100644
--- a/src/jogl/classes/com/jogamp/graph/geom/Triangle.java
+++ b/src/jogl/classes/com/jogamp/graph/geom/Triangle.java
@@ -67,11 +67,11 @@ public class Triangle {
/**
* Returns a transformed a clone of this instance using the given AffineTransform.
*/
- public Triangle transform(AffineTransform t) {
+ public Triangle transform(final AffineTransform t, final Vertex.Factory<? extends Vertex> vertexFactory) {
final Triangle tri = new Triangle(id, boundaryEdges, boundaryVertices);
- tri.vertices[0] = t.transform(vertices[0], null);
- tri.vertices[1] = t.transform(vertices[1], null);
- tri.vertices[2] = t.transform(vertices[2], null);
+ tri.vertices[0] = t.transform(vertices[0], vertexFactory.create());
+ tri.vertices[1] = t.transform(vertices[1], vertexFactory.create());
+ tri.vertices[2] = t.transform(vertices[2], vertexFactory.create());
return tri;
}
diff --git a/src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java b/src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java
index c28b36f82..23edfd6e7 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java
@@ -27,6 +27,8 @@
*/
package com.jogamp.opengl.math.geom;
+import jogamp.graph.geom.plane.AffineTransform;
+
import com.jogamp.opengl.math.FloatUtil;
import com.jogamp.opengl.math.VectorUtil;
import com.jogamp.opengl.util.PMVMatrix;
@@ -60,8 +62,8 @@ public class AABBox implements Cloneable {
* @param hy max y-coordinate
* @param hz max z-coordinate
*/
- public AABBox(float lx, float ly, float lz,
- float hx, float hy, float hz) {
+ public AABBox(final float lx, final float ly, final float lz,
+ final float hx, final float hy, final float hz) {
setSize(lx, ly, lz, hx, hy, hz);
}
@@ -69,7 +71,7 @@ public class AABBox implements Cloneable {
* @param low min xyz-coordinates
* @param high max xyz-coordinates
*/
- public AABBox(float[] low, float[] high) {
+ public AABBox(final float[] low, final float[] high) {
setSize(low[0],low[1],low[2], high[0],high[1],high[2]);
}
@@ -89,7 +91,7 @@ public class AABBox implements Cloneable {
return high;
}
- private final void setHigh(float hx, float hy, float hz) {
+ private final void setHigh(final float hx, final float hy, final float hz) {
this.high[0] = hx;
this.high[1] = hy;
this.high[2] = hz;
@@ -102,7 +104,7 @@ public class AABBox implements Cloneable {
return low;
}
- private final void setLow(float lx, float ly, float lz) {
+ private final void setLow(final float lx, final float ly, final float lz) {
this.low[0] = lx;
this.low[1] = ly;
this.low[2] = lz;
@@ -125,8 +127,8 @@ public class AABBox implements Cloneable {
* @param hy max y-coordinate
* @param hz max z-coordinate
*/
- public final void setSize(float lx, float ly, float lz,
- float hx, float hy, float hz) {
+ public final void setSize(final float lx, final float ly, final float lz,
+ final float hx, final float hy, final float hz) {
this.low[0] = lx;
this.low[1] = ly;
this.low[2] = lz;
@@ -139,7 +141,7 @@ public class AABBox implements Cloneable {
/** Resize the AABBox to encapsulate another AABox
* @param newBox AABBox to be encapsulated in
*/
- public final void resize(AABBox newBox) {
+ public final void resize(final AABBox newBox) {
float[] newLow = newBox.getLow();
float[] newHigh = newBox.getHigh();
@@ -162,13 +164,43 @@ public class AABBox implements Cloneable {
computeCenter();
}
+ public final void resize(final AABBox newBox, final AffineTransform t, final float[] tmpV3) {
+ /** test low */
+ {
+ final float[] newBoxLow = newBox.getLow();
+ t.transform(newBoxLow, tmpV3);
+ tmpV3[2] = newBoxLow[2];
+ if (tmpV3[0] < low[0])
+ low[0] = tmpV3[0];
+ if (tmpV3[1] < low[1])
+ low[1] = tmpV3[1];
+ if (tmpV3[2] < low[2])
+ low[2] = tmpV3[2];
+ }
+
+ /** test high */
+ {
+ final float[] newBoxHigh = newBox.getHigh();
+ t.transform(newBoxHigh, tmpV3);
+ tmpV3[2] = newBoxHigh[2];
+ if (tmpV3[0] > high[0])
+ high[0] = tmpV3[0];
+ if (tmpV3[1] > high[1])
+ high[1] = tmpV3[1];
+ if (tmpV3[2] > high[2])
+ high[2] = tmpV3[2];
+ }
+
+ computeCenter();
+ }
+
/** Resize the AABBox to encapsulate the passed
* xyz-coordinates.
* @param x x-axis coordinate value
* @param y y-axis coordinate value
* @param z z-axis coordinate value
*/
- public final void resize(float x, float y, float z) {
+ public final void resize(final float x, final float y, final float z) {
/** test low */
if (x < low[0]) {
low[0] = x;
@@ -194,15 +226,25 @@ public class AABBox implements Cloneable {
computeCenter();
}
- /** Resize the AABBox to encapsulate the passed
+ /**
+ * Resize the AABBox to encapsulate the passed
* xyz-coordinates.
* @param xyz xyz-axis coordinate values
* @param offset of the array
*/
- public final void resize(float[] xyz, int offset) {
+ public final void resize(final float[] xyz, final int offset) {
resize(xyz[0+offset], xyz[1+offset], xyz[2+offset]);
}
+ /**
+ * Resize the AABBox to encapsulate the passed
+ * xyz-coordinates.
+ * @param xyz xyz-axis coordinate values
+ */
+ public final void resize(final float[] xyz) {
+ resize(xyz[0], xyz[1], xyz[2]);
+ }
+
/** Check if the x & y coordinates are bounded/contained
* by this AABBox
* @param x x-axis coordinate value
@@ -210,7 +252,7 @@ public class AABBox implements Cloneable {
* @return true if x belong to (low.x, high.x) and
* y belong to (low.y, high.y)
*/
- public final boolean contains(float x, float y) {
+ public final boolean contains(final float x, final float y) {
if(x<low[0] || x>high[0]){
return false;
}
@@ -228,7 +270,7 @@ public class AABBox implements Cloneable {
* @return true if x belong to (low.x, high.x) and
* y belong to (low.y, high.y) and z belong to (low.z, high.z)
*/
- public final boolean contains(float x, float y, float z) {
+ public final boolean contains(final float x, final float y, final float z) {
if(x<low[0] || x>high[0]){
return false;
}
@@ -249,7 +291,7 @@ public class AABBox implements Cloneable {
* @param h hight
* @return true if this AABBox might have a common region with this 2D region
*/
- public final boolean intersects(float x, float y, float w, float h) {
+ public final boolean intersects(final float x, final float y, final float w, final float h) {
if (w <= 0 || h <= 0) {
return false;
}
@@ -289,7 +331,7 @@ public class AABBox implements Cloneable {
* @param size a constant float value
* @param tmpV3 caller provided temporary 3-component vector
*/
- public final void scale(float size, float[] tmpV3) {
+ public final void scale(final float size, final float[] tmpV3) {
tmpV3[0] = high[0] - center[0];
tmpV3[1] = high[1] - center[1];
tmpV3[2] = high[2] - center[2];
diff --git a/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java b/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java
index 362c29204..fdf317f68 100644
--- a/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java
+++ b/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java
@@ -22,7 +22,6 @@ package jogamp.graph.geom.plane;
// import jogamp.opengl.util.HashCode;
import com.jogamp.graph.geom.Vertex;
-import com.jogamp.graph.geom.Vertex.Factory;
import com.jogamp.opengl.math.FloatUtil;
import com.jogamp.opengl.math.geom.AABBox;
@@ -51,8 +50,6 @@ public class AffineTransform implements Cloneable {
*/
static final float ZERO = (float) 1E-10;
- private final Vertex.Factory<? extends Vertex> pointFactory;
-
/**
* The values of transformation matrix
*/
@@ -69,17 +66,10 @@ public class AffineTransform implements Cloneable {
transient int type;
public AffineTransform() {
- pointFactory = null;
- setToIdentity();
- }
-
- public AffineTransform(Factory<? extends Vertex> factory) {
- pointFactory = factory;
setToIdentity();
}
public AffineTransform(AffineTransform t) {
- this.pointFactory = t.pointFactory;
this.type = t.type;
this.m00 = t.m00;
this.m10 = t.m10;
@@ -89,8 +79,7 @@ public class AffineTransform implements Cloneable {
this.m12 = t.m12;
}
- public AffineTransform(Vertex.Factory<? extends Vertex> factory, float m00, float m10, float m01, float m11, float m02, float m12) {
- pointFactory = factory;
+ public AffineTransform(float m00, float m10, float m01, float m11, float m02, float m12) {
this.type = TYPE_UNKNOWN;
this.m00 = m00;
this.m10 = m10;
@@ -100,8 +89,7 @@ public class AffineTransform implements Cloneable {
this.m12 = m12;
}
- public AffineTransform(Vertex.Factory<? extends Vertex> factory, float[] matrix) {
- pointFactory = factory;
+ public AffineTransform(float[] matrix) {
this.type = TYPE_UNKNOWN;
m00 = matrix[0];
m10 = matrix[1];
@@ -113,8 +101,6 @@ public class AffineTransform implements Cloneable {
}
}
- public final Vertex.Factory<? extends Vertex> getFactory() { return pointFactory; }
-
/*
* Method returns type of affine transformation.
*
@@ -303,66 +289,65 @@ public class AffineTransform implements Cloneable {
type = TYPE_UNKNOWN;
}
- public static <T extends Vertex> AffineTransform getTranslateInstance(Vertex.Factory<? extends Vertex> factory, float mx, float my) {
- AffineTransform t = new AffineTransform(factory);
+ public static AffineTransform getTranslateInstance(float mx, float my) {
+ AffineTransform t = new AffineTransform();
t.setToTranslation(mx, my);
return t;
}
- public static <T extends Vertex> AffineTransform getScaleInstance(Vertex.Factory<? extends Vertex> factory, float scx, float scY) {
- AffineTransform t = new AffineTransform(factory);
+ public static AffineTransform getScaleInstance(float scx, float scY) {
+ AffineTransform t = new AffineTransform();
t.setToScale(scx, scY);
return t;
}
- public static <T extends Vertex> AffineTransform getShearInstance(Vertex.Factory<? extends Vertex> factory, float shx, float shy) {
- AffineTransform t = new AffineTransform(factory);
+ public static AffineTransform getShearInstance(float shx, float shy) {
+ AffineTransform t = new AffineTransform();
t.setToShear(shx, shy);
return t;
}
- public static <T extends Vertex> AffineTransform getRotateInstance(Vertex.Factory<? extends Vertex> factory, float angle) {
- AffineTransform t = new AffineTransform(factory);
+ public static AffineTransform getRotateInstance(float angle) {
+ AffineTransform t = new AffineTransform();
t.setToRotation(angle);
return t;
}
- public static <T extends Vertex> AffineTransform getRotateInstance(Vertex.Factory<? extends Vertex> factory, float angle, float x, float y) {
- AffineTransform t = new AffineTransform(factory);
+ public static AffineTransform getRotateInstance(float angle, float x, float y) {
+ AffineTransform t = new AffineTransform();
t.setToRotation(angle, x, y);
return t;
}
public final void translate(float mx, float my) {
- concatenate(AffineTransform.getTranslateInstance(pointFactory, mx, my));
+ concatenate(AffineTransform.getTranslateInstance(mx, my));
}
public final void scale(float scx, float scy) {
- concatenate(AffineTransform.getScaleInstance(pointFactory, scx, scy));
+ concatenate(AffineTransform.getScaleInstance(scx, scy));
}
public final void shear(float shx, float shy) {
- concatenate(AffineTransform.getShearInstance(pointFactory, shx, shy));
+ concatenate(AffineTransform.getShearInstance(shx, shy));
}
public final void rotate(float angle) {
- concatenate(AffineTransform.getRotateInstance(pointFactory, angle));
+ concatenate(AffineTransform.getRotateInstance(angle));
}
public final void rotate(float angle, float px, float py) {
- concatenate(AffineTransform.getRotateInstance(pointFactory, angle, px, py));
+ concatenate(AffineTransform.getRotateInstance(angle, px, py));
}
/**
* Multiply matrix of two AffineTransform objects.
- * The first argument's {@link Vertex.Factory} is being used.
* @param tL - the AffineTransform object is a multiplicand (left argument)
* @param tR - the AffineTransform object is a multiplier (right argument)
*
* @return A new AffineTransform object containing the result of [tL] X [tR].
*/
public final static AffineTransform multiply(final AffineTransform tL, final AffineTransform tR) {
- return new AffineTransform(tR.pointFactory,
+ return new AffineTransform(
tR.m00 * tL.m00 + tR.m10 * tL.m01, // m00
tR.m00 * tL.m10 + tR.m10 * tL.m11, // m10
tR.m01 * tL.m00 + tR.m11 * tL.m01, // m01
@@ -421,7 +406,6 @@ public class AffineTransform implements Cloneable {
throw new NoninvertibleTransformException(determinantIsZero);
}
return new AffineTransform(
- this.pointFactory,
m11 / det, // m00
-m10 / det, // m10
-m01 / det, // m01
@@ -431,10 +415,13 @@ public class AffineTransform implements Cloneable {
);
}
- public final AABBox transform(final AABBox src, AABBox dst) {
- if (dst == null) {
- dst = new AABBox();
- }
+ /**
+ *
+ * @param src
+ * @param dst
+ * @return dst for chaining
+ */
+ public final AABBox transform(final AABBox src, final AABBox dst) {
final float[] srcLo = src.getLow();
final float[] srcHi = src.getHigh();
dst.setSize(srcLo[0] * m00 + srcLo[1] * m01 + m02, srcLo[0] * m10 + srcLo[1] * m11 + m12, srcLo[2],
@@ -442,17 +429,19 @@ public class AffineTransform implements Cloneable {
return dst;
}
- public final Vertex transform(final Vertex src, Vertex dst) {
- if (dst == null) {
- dst = pointFactory.create(src.getId(), src.isOnCurve(), src.getTexCoord());
- }
+ /**
+ * @param src
+ * @param dst
+ * @return dst for chaining
+ */
+ public final Vertex transform(final Vertex src, final Vertex dst) {
final float x = src.getX();
final float y = src.getY();
dst.setCoord(x * m00 + y * m01 + m02, x * m10 + y * m11 + m12, src.getZ());
return dst;
}
- public final void transform(Vertex[] src, int srcOff, Vertex[] dst, int dstOff, int length) {
+ 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];
@@ -466,11 +455,17 @@ public class AffineTransform implements Cloneable {
}
}
- public final void transform(final float[] src, final float[] dst) {
+ /**
+ * @param src float[2] source of transformation
+ * @param dst float[2] destination of transformation, maybe be equal to <code>src</code>
+ * @return dst for chaining
+ */
+ public final float[] transform(final float[] src, final float[] dst) {
final float x = src[0];
final float y = src[1];
dst[0] = x * m00 + y * m01 + m02;
dst[1] = x * m10 + y * m11 + m12;
+ return dst;
}
public final void transform(final float[] src, final int srcOff, final float[] dst, final int dstOff) {
@@ -497,17 +492,20 @@ public class AffineTransform implements Cloneable {
}
}
- public final Vertex deltaTransform(Vertex src, Vertex dst) {
- if (dst == null) {
- dst = pointFactory.create(src.getId(), src.isOnCurve(), src.getTexCoord());
- }
+ /**
+ *
+ * @param src
+ * @param dst
+ * @return return dst for chaining
+ */
+ public final Vertex deltaTransform(final Vertex src, final Vertex dst) {
final float x = src.getX();
final float y = src.getY();
dst.setCoord(x * m00 + y * m01, x * m10 + y * m11, src.getZ());
return dst;
}
- public final void deltaTransform(float[] src, int srcOff, float[] dst, int dstOff, int length) {
+ 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++];
@@ -516,21 +514,25 @@ public class AffineTransform implements Cloneable {
}
}
- public final Vertex inverseTransform(Vertex src, Vertex dst) throws NoninvertibleTransformException {
+ /**
+ *
+ * @param src
+ * @param dst
+ * @return return dst for chaining
+ * @throws NoninvertibleTransformException
+ */
+ public final Vertex inverseTransform(final Vertex src, final Vertex dst) throws NoninvertibleTransformException {
float det = getDeterminant();
if (FloatUtil.abs(det) < ZERO) {
throw new NoninvertibleTransformException(determinantIsZero);
}
- if (dst == null) {
- dst = pointFactory.create(src.getId(), src.isOnCurve(), src.getTexCoord());
- }
final float x = src.getX() - m02;
final float y = src.getY() - m12;
dst.setCoord((x * m11 - y * m01) / det, (y * m00 - x * m10) / det, src.getZ());
return dst;
}
- public final void inverseTransform(float[] src, int srcOff, float[] dst, int dstOff, int length)
+ public final void inverseTransform(final float[] src, int srcOff, final float[] dst, int dstOff, int length)
throws NoninvertibleTransformException
{
float det = getDeterminant();