Skip to content

Commit b66633e

Browse files
bhoustonmrdoob
authored andcommitted
Ensure empty box is still an empty box after a Box3.applyTransform
* ensure that an empty box is still an empty box aftering being transformed. * fix docs to match new behavior.
1 parent ce2dd7c commit b66633e

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

docs/api/math/Box3.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ <h3>[method:Box3 applyMatrix4]( [page:Matrix4 matrix] ) [page:Box3 this]</h3>
5858
</div>
5959
<div>
6060
Transforms this Box3 with the supplied matrix.
61-
This method must not be used on empty boxes.
6261
</div>
6362

6463
<h3>[method:Vector3 clampPoint]( [page:Vector3 point], [page:Vector3 optionalTarget] ) [page:Box3 this]</h3>

src/math/Box3.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,9 @@ THREE.Box3.prototype = {
413413

414414
return function ( matrix ) {
415415

416+
// transform of empty box is an empty box.
417+
if( this.isEmpty() ) return this;
418+
416419
// NOTE: I am using a binary pattern to specify all 2^3 combinations below
417420
points[ 0 ].set( this.min.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 000
418421
points[ 1 ].set( this.min.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 001
@@ -423,7 +426,6 @@ THREE.Box3.prototype = {
423426
points[ 6 ].set( this.max.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 110
424427
points[ 7 ].set( this.max.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 111
425428

426-
this.makeEmpty();
427429
this.setFromPoints( points );
428430

429431
return this;

0 commit comments

Comments
 (0)