|
@@ -106,6 +106,32 @@ test( "setFromMatrix/makeFrustum/containsPoint", function() {
|
|
ok( ! a.containsPoint( new THREE.Vector3( 0, 0, -101 ) ), "Passed!" );
|
|
ok( ! a.containsPoint( new THREE.Vector3( 0, 0, -101 ) ), "Passed!" );
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+test( "setFromMatrix/makeFrustum/containsSphere", function() {
|
|
|
|
+ var m = new THREE.Matrix4().makeFrustum( -1, 1, -1, 1, 1, 100 )
|
|
|
|
+ var a = new THREE.Frustum().setFromMatrix( m );
|
|
|
|
+
|
|
|
|
+ ok( ! a.containsSphere( new THREE.Sphere( new THREE.Vector3( 0, 0, 0 ), 0 ) ), "Passed!" );
|
|
|
|
+ ok( ! a.containsSphere( new THREE.Sphere( new THREE.Vector3( 0, 0, 0 ), 0.9 ) ), "Passed!" );
|
|
|
|
+ ok( a.containsSphere( new THREE.Sphere( new THREE.Vector3( 0, 0, 0 ), 1.1 ) ), "Passed!" );
|
|
|
|
+ ok( a.containsSphere( new THREE.Sphere( new THREE.Vector3( 0, 0, -50 ), 0 ) ), "Passed!" );
|
|
|
|
+ ok( a.containsSphere( new THREE.Sphere( new THREE.Vector3( 0, 0, -1.001 ), 0 ) ), "Passed!" );
|
|
|
|
+ ok( a.containsSphere( new THREE.Sphere( new THREE.Vector3( -1, -1, -1.001 ), 0 ) ), "Passed!" );
|
|
|
|
+ ok( ! a.containsSphere( new THREE.Sphere( new THREE.Vector3( -1.1, -1.1, -1.001 ), 0 ) ), "Passed!" );
|
|
|
|
+ ok( a.containsSphere( new THREE.Sphere( new THREE.Vector3( -1.1, -1.1, -1.001 ), 0.5 ) ), "Passed!" );
|
|
|
|
+ ok( a.containsSphere( new THREE.Sphere( new THREE.Vector3( 1, 1, -1.001 ), 0 ) ), "Passed!" );
|
|
|
|
+ ok( ! a.containsSphere( new THREE.Sphere( new THREE.Vector3( 1.1, 1.1, -1.001 ), 0 ) ), "Passed!" );
|
|
|
|
+ ok( a.containsSphere( new THREE.Sphere( new THREE.Vector3( 1.1, 1.1, -1.001 ), 0.5 ) ), "Passed!" );
|
|
|
|
+ ok( a.containsSphere( new THREE.Sphere( new THREE.Vector3( 0, 0, -99.999 ), 0 ) ), "Passed!" );
|
|
|
|
+ ok( a.containsSphere( new THREE.Sphere( new THREE.Vector3( -99.999, -99.999, -99.999 ), 0 ) ), "Passed!" );
|
|
|
|
+ ok( ! a.containsSphere( new THREE.Sphere( new THREE.Vector3( -100.1, -100.1, -100.1 ), 0 ) ), "Passed!" );
|
|
|
|
+ ok( a.containsSphere( new THREE.Sphere( new THREE.Vector3( -100.1, -100.1, -100.1 ), 0.5 ) ), "Passed!" );
|
|
|
|
+ ok( a.containsSphere( new THREE.Sphere( new THREE.Vector3( 99.999, 99.999, -99.999 ), 0 ) ), "Passed!" );
|
|
|
|
+ ok( ! a.containsSphere( new THREE.Sphere( new THREE.Vector3( 100.1, 100.1, -100.1 ), 0 ) ), "Passed!" );
|
|
|
|
+ ok( a.containsSphere( new THREE.Sphere( new THREE.Vector3( 100.1, 100.1, -100.1 ), 0.2 ) ), "Passed!" );
|
|
|
|
+ ok( ! a.containsSphere( new THREE.Sphere( new THREE.Vector3( 0, 0, -101 ), 0 ) ), "Passed!" );
|
|
|
|
+ ok( a.containsSphere( new THREE.Sphere( new THREE.Vector3( 0, 0, -101 ), 1.1 ) ), "Passed!" );
|
|
|
|
+});
|
|
|
|
+
|
|
test( "transform", function() {
|
|
test( "transform", function() {
|
|
|
|
|
|
var p0 = new THREE.Plane( unit3, -1 );
|
|
var p0 = new THREE.Plane( unit3, -1 );
|