@@ -8,7 +8,13 @@ import { Vector3 } from '../../../../src/math/Vector3';
88import { Matrix4 } from '../../../../src/math/Matrix4' ;
99import { Mesh } from '../../../../src/objects/Mesh' ;
1010import { BufferAttribute } from '../../../../src/core/BufferAttribute' ;
11- import { BoxGeometry } from '../../../../src/geometries/BoxGeometry' ;
11+ import {
12+ BoxGeometry ,
13+ BoxBufferGeometry ,
14+ } from '../../../../src/geometries/BoxGeometry' ;
15+ import {
16+ SphereBufferGeometry ,
17+ } from '../../../../src/geometries/SphereGeometry' ;
1218import {
1319 negInf3 ,
1420 posInf3 ,
@@ -165,8 +171,31 @@ export default QUnit.module( 'Maths', () => {
165171
166172 } ) ;
167173
168- QUnit . test ( 'clone' , ( assert ) => {
174+ QUnit . test ( 'setFromObject/Precise' , ( assert ) => {
175+
176+ var a = new Box3 ( zero3 . clone ( ) , one3 . clone ( ) ) ;
177+ var object = new Mesh ( new SphereBufferGeometry ( 1 , 32 , 32 ) ) ;
178+ var child = new Mesh ( new SphereBufferGeometry ( 2 , 32 , 32 ) ) ;
179+ object . add ( child ) ;
169180
181+ object . rotation . setFromVector3 ( new Vector3 ( 0 , 0 , Math . PI / 4.0 ) ) ;
182+
183+ a . setFromObject ( object ) ;
184+ var rotatedBox = new Box3 (
185+ new Vector3 ( - 2 * Math . SQRT2 , - 2 * Math . SQRT2 , - 2 ) ,
186+ new Vector3 ( 2 * Math . SQRT2 , 2 * Math . SQRT2 , 2 )
187+ ) ;
188+ assert . ok ( compareBox ( a , rotatedBox ) , "Passed!" ) ;
189+
190+ a . setFromObject ( object , true ) ;
191+ var rotatedMinBox = new Box3 (
192+ new Vector3 ( - 2 , - 2 , - 2 ) ,
193+ new Vector3 ( 2 , 2 , 2 )
194+ ) ;
195+ assert . ok ( compareBox ( a , rotatedMinBox ) , "Passed!" ) ;
196+ } ) ;
197+
198+ QUnit . test ( 'clone' , ( assert ) => {
170199
171200 var a = new Box3 ( zero3 . clone ( ) , one3 . clone ( ) ) ;
172201
0 commit comments