aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java16
1 files changed, 13 insertions, 3 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 8a18ea4c4..7ab02ba64 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java
@@ -121,9 +121,9 @@ public class AABBox implements Cloneable {
}
private final void computeCenter() {
- center[0] = (high[0] + low[0])/2;
- center[1] = (high[1] + low[1])/2;
- center[2] = (high[2] + low[2])/2;
+ center[0] = (high[0] + low[0])/2f;
+ center[1] = (high[1] + low[1])/2f;
+ center[2] = (high[2] + low[2])/2f;
}
/**
@@ -410,6 +410,16 @@ public class AABBox implements Cloneable {
VectorUtil.addVec3(low, center, tmpV3);
}
+ /**
+ * Translate the AABBox by a float[3] vector
+ * @param t the float[3] translation vector
+ */
+ public final void translate(final float[] t) {
+ VectorUtil.addVec3(low, low, t); // in-place translate
+ VectorUtil.addVec3(high, high, t); // in-place translate
+ computeCenter();
+ }
+
public final float getMinX() {
return low[0];
}