aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes/share
diff options
context:
space:
mode:
authorKevin Rushforth <[email protected]>2004-10-05 17:58:09 +0000
committerKevin Rushforth <[email protected]>2004-10-05 17:58:09 +0000
commitfe828671ea6e137c4caf9d119e601c6fb80543f0 (patch)
tree40f92945d6ff8a4729ff8a66c6c9bfa0a510e6de /src/classes/share
parentcf6b1b2ae2b48e46c6e09932902c0fd72e24f501 (diff)
Issue number: 36
Submitted by: kcr Fixed Issue 36 -- Vector3d hashCode() method distinguishes between -0.0 and 0.0 git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@52 ba19aa83-45c5-6ac9-afd3-db810772062c
Diffstat (limited to 'src/classes/share')
-rw-r--r--src/classes/share/javax/media/j3d/BoundingBox.java13
-rw-r--r--src/classes/share/javax/media/j3d/BoundingPolytope.java9
-rw-r--r--src/classes/share/javax/media/j3d/BoundingSphere.java9
-rw-r--r--src/classes/share/javax/media/j3d/Transform3D.java4
4 files changed, 19 insertions, 16 deletions
diff --git a/src/classes/share/javax/media/j3d/BoundingBox.java b/src/classes/share/javax/media/j3d/BoundingBox.java
index a6d8f4f..2e9228c 100644
--- a/src/classes/share/javax/media/j3d/BoundingBox.java
+++ b/src/classes/share/javax/media/j3d/BoundingBox.java
@@ -13,6 +13,7 @@
package javax.media.j3d;
import javax.vecmath.*;
+import com.sun.j3d.internal.HashCodeUtil;
/**
* This class defines an axis aligned bounding box which is used for
@@ -418,12 +419,12 @@ public class BoundingBox extends Bounds {
*/
public int hashCode() {
long bits = 1L;
- bits = 31L * bits + Double.doubleToLongBits(lower.x);
- bits = 31L * bits + Double.doubleToLongBits(lower.y);
- bits = 31L * bits + Double.doubleToLongBits(lower.z);
- bits = 31L * bits + Double.doubleToLongBits(upper.x);
- bits = 31L * bits + Double.doubleToLongBits(upper.y);
- bits = 31L * bits + Double.doubleToLongBits(upper.z);
+ bits = 31L * bits + HashCodeUtil.doubleToLongBits(lower.x);
+ bits = 31L * bits + HashCodeUtil.doubleToLongBits(lower.y);
+ bits = 31L * bits + HashCodeUtil.doubleToLongBits(lower.z);
+ bits = 31L * bits + HashCodeUtil.doubleToLongBits(upper.x);
+ bits = 31L * bits + HashCodeUtil.doubleToLongBits(upper.y);
+ bits = 31L * bits + HashCodeUtil.doubleToLongBits(upper.z);
return (int) (bits ^ (bits >> 32));
}
diff --git a/src/classes/share/javax/media/j3d/BoundingPolytope.java b/src/classes/share/javax/media/j3d/BoundingPolytope.java
index 2c6ae33..91076ee 100644
--- a/src/classes/share/javax/media/j3d/BoundingPolytope.java
+++ b/src/classes/share/javax/media/j3d/BoundingPolytope.java
@@ -14,6 +14,7 @@ package javax.media.j3d;
import javax.vecmath.*;
import java.lang.Math;
+import com.sun.j3d.internal.HashCodeUtil;
/**
* A BoundingPolytope defines a polyhedral bounding region using the
@@ -514,10 +515,10 @@ public class BoundingPolytope extends Bounds {
long bits = 1L;
for (int i = 0; i < planes.length; i++) {
- bits = 31L * bits + Double.doubleToLongBits(planes[i].x);
- bits = 31L * bits + Double.doubleToLongBits(planes[i].y);
- bits = 31L * bits + Double.doubleToLongBits(planes[i].z);
- bits = 31L * bits + Double.doubleToLongBits(planes[i].w);
+ bits = 31L * bits + HashCodeUtil.doubleToLongBits(planes[i].x);
+ bits = 31L * bits + HashCodeUtil.doubleToLongBits(planes[i].y);
+ bits = 31L * bits + HashCodeUtil.doubleToLongBits(planes[i].z);
+ bits = 31L * bits + HashCodeUtil.doubleToLongBits(planes[i].w);
}
return (int) (bits ^ (bits >> 32));
diff --git a/src/classes/share/javax/media/j3d/BoundingSphere.java b/src/classes/share/javax/media/j3d/BoundingSphere.java
index 796adac..6e7e2e4 100644
--- a/src/classes/share/javax/media/j3d/BoundingSphere.java
+++ b/src/classes/share/javax/media/j3d/BoundingSphere.java
@@ -14,6 +14,7 @@ package javax.media.j3d;
import javax.vecmath.*;
import java.lang.Math;
+import com.sun.j3d.internal.HashCodeUtil;
/**
* This class defines a spherical bounding region which is defined by a
@@ -406,10 +407,10 @@ public class BoundingSphere extends Bounds {
*/
public int hashCode() {
long bits = 1L;
- bits = 31L * bits + Double.doubleToLongBits(radius);
- bits = 31L * bits + Double.doubleToLongBits(center.x);
- bits = 31L * bits + Double.doubleToLongBits(center.y);
- bits = 31L * bits + Double.doubleToLongBits(center.z);
+ bits = 31L * bits + HashCodeUtil.doubleToLongBits(radius);
+ bits = 31L * bits + HashCodeUtil.doubleToLongBits(center.x);
+ bits = 31L * bits + HashCodeUtil.doubleToLongBits(center.y);
+ bits = 31L * bits + HashCodeUtil.doubleToLongBits(center.z);
return (int) (bits ^ (bits >> 32));
}
diff --git a/src/classes/share/javax/media/j3d/Transform3D.java b/src/classes/share/javax/media/j3d/Transform3D.java
index 4b1d69f..5bf0da8 100644
--- a/src/classes/share/javax/media/j3d/Transform3D.java
+++ b/src/classes/share/javax/media/j3d/Transform3D.java
@@ -13,7 +13,7 @@
package javax.media.j3d;
import javax.vecmath.*;
-import java.lang.*;
+import com.sun.j3d.internal.HashCodeUtil;
/**
* A generalized transform object represented internally as a 4x4
@@ -3921,7 +3921,7 @@ public class Transform3D {
long bits = 1L;
for (int i = 0; i < 16; i++) {
- bits = 31L * bits + Double.doubleToLongBits(mat[i]);
+ bits = 31L * bits + HashCodeUtil.doubleToLongBits(mat[i]);
}
return (int) (bits ^ (bits >> 32));
}