aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes
diff options
context:
space:
mode:
authorHarvey Harrison <[email protected]>2012-01-14 20:13:08 -0800
committerHarvey Harrison <[email protected]>2012-01-14 20:14:19 -0800
commit545439b2fcf4804bb73c83f835d2680eb0ea3c9a (patch)
treefb107bc13d7725d1c05789956419d601502f84ce /src/classes
parent145862f0370059961084b2f73638822de98e7aad (diff)
j3dcore: use the new set((Bounds)null) fastpath to create empty bounds
Also add a few more calls to the new internal setEmpty/setInfinite helpers. Signed-off-by: Harvey Harrison <[email protected]>
Diffstat (limited to 'src/classes')
-rw-r--r--src/classes/share/javax/media/j3d/BoundingBox.java43
1 files changed, 17 insertions, 26 deletions
diff --git a/src/classes/share/javax/media/j3d/BoundingBox.java b/src/classes/share/javax/media/j3d/BoundingBox.java
index f102f46..bd2e134 100644
--- a/src/classes/share/javax/media/j3d/BoundingBox.java
+++ b/src/classes/share/javax/media/j3d/BoundingBox.java
@@ -343,7 +343,7 @@ public BoundingBox(Bounds[] bounds) {
public void set(Bounds boundsObject) {
int i;
- if ((boundsObject == null) || (boundsObject.boundsIsEmpty)) {
+ if (boundsObject == null || boundsObject.boundsIsEmpty) {
setEmptyBounds();
return;
}
@@ -1410,9 +1410,7 @@ public BoundingBox(Bounds[] bounds) {
public boolean intersect(Bounds boundsObject, BoundingBox newBoundBox) {
if((boundsObject == null) || boundsIsEmpty || boundsObject.boundsIsEmpty ) {
- // Negative volume.
- newBoundBox.setLower( 1.0d, 1.0d, 1.0d);
- newBoundBox.setUpper(-1.0d, -1.0d, -1.0d);
+ newBoundBox.set((Bounds)null);
return false;
}
@@ -1471,8 +1469,7 @@ public BoundingBox(Bounds[] bounds) {
return true;
} else {
// Negative volume.
- newBoundBox.setLower( 1.0d, 1.0d, 1.0d);
- newBoundBox.setUpper(-1.0d, -1.0d, -1.0d);
+ newBoundBox.set((Bounds)null);
return false;
}
}
@@ -1484,8 +1481,7 @@ public BoundingBox(Bounds[] bounds) {
return true;
} else {
// Negative volume.
- newBoundBox.setLower( 1.0d, 1.0d, 1.0d);
- newBoundBox.setUpper(-1.0d, -1.0d, -1.0d);
+ newBoundBox.set((Bounds)null);
return false;
}
@@ -1499,8 +1495,7 @@ public BoundingBox(Bounds[] bounds) {
return true;
} else {
// Negative volume.
- newBoundBox.setLower( 1.0d, 1.0d, 1.0d);
- newBoundBox.setUpper(-1.0d, -1.0d, -1.0d);
+ newBoundBox.set((Bounds)null);
return false;
}
} else {
@@ -1518,10 +1513,9 @@ public BoundingBox(Bounds[] bounds) {
public boolean intersect(Bounds[] boundsObjects, BoundingBox newBoundBox) {
if( boundsObjects == null || boundsObjects.length <= 0 || boundsIsEmpty ) {
- // Negative volume.
- newBoundBox.setLower( 1.0d, 1.0d, 1.0d);
- newBoundBox.setUpper(-1.0d, -1.0d, -1.0d);
- return false;
+ // Negative volume.
+ newBoundBox.set((Bounds)null);
+ return false;
}
int i=0;
@@ -1531,9 +1525,8 @@ public BoundingBox(Bounds[] bounds) {
}
if( i >= boundsObjects.length ) { // all bounds objects were empty
- // Negative volume.
- newBoundBox.setLower( 1.0d, 1.0d, 1.0d);
- newBoundBox.setUpper(-1.0d, -1.0d, -1.0d);
+ // Negative volume.
+ newBoundBox.set((Bounds)null);
return false;
}
@@ -1618,8 +1611,7 @@ public BoundingBox(Bounds[] bounds) {
}
if( status == false ) {
// Negative volume.
- newBoundBox.setLower( 1.0d, 1.0d, 1.0d);
- newBoundBox.setUpper(-1.0d, -1.0d, -1.0d);
+ newBoundBox.set((Bounds)null);
}
return status;
}
@@ -1917,14 +1909,13 @@ private void setInfiniteBounds() {
void translate(BoundingBox bbox, Vector3d value) {
if (bbox == null || bbox.boundsIsEmpty) {
- // Negative volume.
- setLower( 1.0d, 1.0d, 1.0d);
- setUpper(-1.0d, -1.0d, -1.0d);
- return;
+ setEmptyBounds();
+ return;
}
- if(bbox.boundsIsInfinite) {
- this.set(bbox);
- return;
+
+ if (bbox.boundsIsInfinite) {
+ setInfiniteBounds();
+ return;
}
lower.x = bbox.lower.x + value.x;