Browse Source

Terminate statement and simplify if statement from Frustrum test

Tristan Valcke 8 years ago
parent
commit
f3b9ddf9d4
1 changed files with 7 additions and 11 deletions
  1. 7 11
      test/unit/math/Frustum.js

+ 7 - 11
test/unit/math/Frustum.js

@@ -7,14 +7,10 @@ module( "Frustum" );
 var unit3 = new THREE.Vector3( 1, 0, 0 );
 
 var planeEquals = function ( a, b, tolerance ) {
+
 	tolerance = tolerance || 0.0001;
-	if( a.normal.distanceTo( b.normal ) > tolerance ) {
-		return false;
-	}
-	if( Math.abs( a.constant - b.constant ) > tolerance ) {
-		return false;
-	}
-	return true;
+	return !( a.normal.distanceTo( b.normal ) > tolerance ) && !( Math.abs( a.constant - b.constant ) > tolerance );
+
 };
 
 test( "constructor", function() {
@@ -68,7 +64,7 @@ test( "copy", function() {
 });
 
 test( "setFromMatrix/makeOrthographic/containsPoint", function() {
-	var m = new THREE.Matrix4().makeOrthographic( -1, 1, -1, 1, 1, 100 )
+	var m = new THREE.Matrix4().makeOrthographic( -1, 1, -1, 1, 1, 100 );
 	var a = new THREE.Frustum().setFromMatrix( m );
 
 	ok( ! a.containsPoint( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" );
@@ -88,7 +84,7 @@ test( "setFromMatrix/makeOrthographic/containsPoint", function() {
 });
 
 test( "setFromMatrix/makeFrustum/containsPoint", function() {
-	var m = new THREE.Matrix4().makeFrustum( -1, 1, -1, 1, 1, 100 )
+	var m = new THREE.Matrix4().makeFrustum( -1, 1, -1, 1, 1, 100 );
 	var a = new THREE.Frustum().setFromMatrix( m );
 
 	ok( ! a.containsPoint( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" );
@@ -107,7 +103,7 @@ test( "setFromMatrix/makeFrustum/containsPoint", function() {
 });
 
 test( "setFromMatrix/makeFrustum/intersectsSphere", function() {
-	var m = new THREE.Matrix4().makeFrustum( -1, 1, -1, 1, 1, 100 )
+	var m = new THREE.Matrix4().makeFrustum( -1, 1, -1, 1, 1, 100 );
 	var a = new THREE.Frustum().setFromMatrix( m );
 
 	ok( ! a.intersectsSphere( new THREE.Sphere( new THREE.Vector3( 0, 0, 0 ), 0 ) ), "Passed!" );
@@ -153,4 +149,4 @@ test( "clone", function() {
 	// ensure it is a true copy by modifying source
 	a.planes[0].copy( p1 );
 	ok( b.planes[0].equals( p0 ), "Passed!" );
-});
+});