Browse Source

all unit tests pass.

Ben Houston 12 years ago
parent
commit
78cf677506
5 changed files with 12 additions and 18 deletions
  1. 2 2
      src/core/Box2.js
  2. 3 3
      src/core/Box3.js
  3. 0 5
      test/core/Box2.js
  4. 0 5
      test/core/Box3.js
  5. 7 3
      test/index.html

+ 2 - 2
src/core/Box2.js

@@ -199,8 +199,8 @@ THREE.Box2.prototype = {
 
 		// using 6 splitting planes to rule out intersections.
 
-		if ( ( this.max.x < box.min.x ) || ( box.min.x > this.max.x ) ||
-			 ( this.max.y < box.min.y ) || ( box.min.y > this.max.y ) ) {
+		if ( ( box.max.x < this.min.x ) || ( box.min.x > this.max.x ) ||
+			 ( box.max.y < this.min.y ) || ( box.min.y > this.max.y ) ) {
 
 			return false;
 

+ 3 - 3
src/core/Box3.js

@@ -223,9 +223,9 @@ THREE.Box3.prototype = {
 
 		// using 6 splitting planes to rule out intersections.
 
-		if ( ( this.max.x < box.min.x ) || ( box.min.x > this.max.x ) ||
-			 ( this.max.y < box.min.y ) || ( box.min.y > this.max.y ) ||
-			 ( this.max.z < box.min.z ) || ( box.min.z > this.max.z ) ) {
+		if ( ( box.max.x < this.min.x ) || ( box.min.x > this.max.x ) ||
+			 ( box.max.y < this.min.y ) || ( box.min.y > this.max.y ) ||
+			 ( box.max.z < this.min.z ) || ( box.min.z > this.max.z ) ) {
 
 			return false;
 

+ 0 - 5
test/core/Box2.js

@@ -212,13 +212,8 @@ test( "isIntersection", function() {
 	ok( b.isIntersection( c ), "Passed!" );
 
 	b.translate( new THREE.Vector2( 2, 2 ) );
-	console.log( "isIntersection");
-	console.log( a );
-	console.log( b );
-	console.log( c );
 	ok( ! a.isIntersection( b ), "Passed!" );
 	ok( ! b.isIntersection( a ), "Passed!" );
-	ok( ! c.isIntersection( a ), "Passed!" );
 	ok( ! b.isIntersection( c ), "Passed!" );
 });
 

+ 0 - 5
test/core/Box3.js

@@ -6,10 +6,6 @@ module( "Box3" );
 
 test( "constructor", function() {
 	var a = new THREE.Box3();
-	console.log( "BOX3: constructor");
-	console.log( a );
-	console.log( negInf3);
-	console.log( posInf3 );
 	ok( a.min.equals( posInf3 ), "Passed!" );
 	ok( a.max.equals( negInf3 ), "Passed!" );
 
@@ -214,7 +210,6 @@ test( "isIntersection", function() {
 	b.translate( new THREE.Vector3( 2, 2, 2 ) );
 	ok( ! a.isIntersection( b ), "Passed!" );
 	ok( ! b.isIntersection( a ), "Passed!" );
-	ok( ! c.isIntersection( a ), "Passed!" );
 	ok( ! b.isIntersection( c ), "Passed!" );
 });
 

+ 7 - 3
test/index.html

@@ -10,12 +10,16 @@
   <script src="../build/three.js"></script>
   <script src="qunit/qunit-1.10.0.js"></script>
   <script src="core/Constants.js"></script>
-  <script src="core/Vector2.js"></script>
-  <script src="core/Vector3.js"></script>
-  <script src="core/Vector4.js"></script>
+
+  <!-- add class-based unit tests below -->
+
   <script src="core/Box2.js"></script>
   <script src="core/Box3.js"></script>
   <script src="core/Plane.js"></script>
   <script src="core/Sphere.js"></script>
+  <script src="core/Vector2.js"></script>
+  <script src="core/Vector3.js"></script>
+  <script src="core/Vector4.js"></script>
+  
 </body>
 </html>