summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl/math
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-04-02 19:25:16 +0200
committerSven Gothel <[email protected]>2014-04-02 19:25:16 +0200
commitabc833631e0ab30a06c7aff47a39a551544fd735 (patch)
tree1d6e5a94d2149d7b2635de5b5eccb330bc41cd2c /src/jogl/classes/com/jogamp/opengl/math
parente8a5a1cbb988670ca206ab1ac633e19a91bfa478 (diff)
Bug 801: Reduce temp. object creation, i.e. GC load
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/math')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java41
1 files changed, 30 insertions, 11 deletions
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 23a0032d2..8a0bf37a0 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java
@@ -51,7 +51,7 @@ import com.jogamp.opengl.util.PMVMatrix;
* </p>
*
*/
-public class AABBox implements Cloneable {
+public class AABBox {
private static final boolean DEBUG = FloatUtil.DEBUG;
private final float[] low = new float[3];
private final float[] high = new float[3];
@@ -70,9 +70,7 @@ public class AABBox implements Cloneable {
* @param src the box value to be used for the new instance
*/
public AABBox(AABBox src) {
- System.arraycopy(src.low, 0, low, 0, 3);
- System.arraycopy(src.high, 0, high, 0, 3);
- System.arraycopy(src.center, 0, center, 0, 3);
+ copy(src);
}
/**
@@ -90,12 +88,13 @@ public class AABBox implements Cloneable {
setSize(lx, ly, lz, hx, hy, hz);
}
- /** Create a AABBox defining the low and high
+ /**
+ * Create a AABBox defining the low and high
* @param low min xyz-coordinates
* @param high max xyz-coordinates
*/
public AABBox(final float[] low, final float[] high) {
- setSize(low[0],low[1],low[2], high[0],high[1],high[2]);
+ setSize(low, high);
}
/**
@@ -144,6 +143,31 @@ public class AABBox implements Cloneable {
}
/**
+ * Copy given AABBox 'src' values to this AABBox.
+ *
+ * @param src source AABBox
+ * @return this AABBox for chaining
+ */
+ public final AABBox copy(AABBox src) {
+ System.arraycopy(src.low, 0, low, 0, 3);
+ System.arraycopy(src.high, 0, high, 0, 3);
+ System.arraycopy(src.center, 0, center, 0, 3);
+ return this;
+ }
+
+ /**
+ * Set size of the AABBox specifying the coordinates
+ * of the low and high.
+ *
+ * @param low min xyz-coordinates
+ * @param high max xyz-coordinates
+ * @return this AABBox for chaining
+ */
+ public final AABBox setSize(final float[] low, final float[] high) {
+ return setSize(low[0],low[1],low[2], high[0],high[1],high[2]);
+ }
+
+ /**
* Set size of the AABBox specifying the coordinates
* of the low and high.
*
@@ -510,11 +534,6 @@ public class AABBox implements Cloneable {
}
@Override
- public final AABBox clone() {
- return new AABBox(this);
- }
-
- @Override
public final boolean equals(Object obj) {
if( obj == this ) {
return true;