|
@@ -8,7 +8,13 @@ import { Vector3 } from '../../../../src/math/Vector3';
|
|
|
import { Matrix4 } from '../../../../src/math/Matrix4';
|
|
|
import { Mesh } from '../../../../src/objects/Mesh';
|
|
|
import { BufferAttribute } from '../../../../src/core/BufferAttribute';
|
|
|
-import { BoxGeometry } from '../../../../src/geometries/BoxGeometry';
|
|
|
+import {
|
|
|
+ BoxGeometry,
|
|
|
+ BoxBufferGeometry,
|
|
|
+} from '../../../../src/geometries/BoxGeometry';
|
|
|
+import {
|
|
|
+ SphereBufferGeometry,
|
|
|
+} from '../../../../src/geometries/SphereGeometry';
|
|
|
import {
|
|
|
negInf3,
|
|
|
posInf3,
|
|
@@ -165,8 +171,31 @@ export default QUnit.module( 'Maths', () => {
|
|
|
|
|
|
} );
|
|
|
|
|
|
- QUnit.test( 'clone', ( assert ) => {
|
|
|
+ QUnit.test( 'setFromObject/Precise', ( assert ) => {
|
|
|
+
|
|
|
+ var a = new Box3( zero3.clone(), one3.clone() );
|
|
|
+ var object = new Mesh( new SphereBufferGeometry( 1, 32, 32 ) );
|
|
|
+ var child = new Mesh( new SphereBufferGeometry( 2, 32, 32 ) );
|
|
|
+ object.add( child );
|
|
|
|
|
|
+ object.rotation.setFromVector3(new Vector3(0, 0, Math.PI / 4.0));
|
|
|
+
|
|
|
+ a.setFromObject( object );
|
|
|
+ var rotatedBox = new Box3(
|
|
|
+ new Vector3( - 2 * Math.SQRT2, - 2 * Math.SQRT2, - 2 ),
|
|
|
+ new Vector3( 2 * Math.SQRT2, 2 * Math.SQRT2, 2 )
|
|
|
+ );
|
|
|
+ assert.ok( compareBox( a, rotatedBox ), "Passed!" );
|
|
|
+
|
|
|
+ a.setFromObject( object, true );
|
|
|
+ var rotatedMinBox = new Box3(
|
|
|
+ new Vector3( - 2, - 2, - 2 ),
|
|
|
+ new Vector3( 2, 2, 2 )
|
|
|
+ );
|
|
|
+ assert.ok( compareBox( a, rotatedMinBox ), "Passed!" );
|
|
|
+ } );
|
|
|
+
|
|
|
+ QUnit.test( 'clone', ( assert ) => {
|
|
|
|
|
|
var a = new Box3( zero3.clone(), one3.clone() );
|
|
|
|