|
6286 | 6286 |
|
6287 | 6287 | },
|
6288 | 6288 |
|
6289 |
| - center: function ( optionalTarget ) { |
| 6289 | + getCenter: function ( optionalTarget ) { |
6290 | 6290 |
|
6291 | 6291 | var result = optionalTarget || new Vector2();
|
6292 |
| - return result.addVectors( this.min, this.max ).multiplyScalar( 0.5 ); |
| 6292 | + return this.isEmpty() ? result.set( 0, 0 ) : result.addVectors( this.min, this.max ).multiplyScalar( 0.5 ); |
6293 | 6293 |
|
6294 | 6294 | },
|
6295 | 6295 |
|
6296 |
| - size: function ( optionalTarget ) { |
| 6296 | + getSize: function ( optionalTarget ) { |
6297 | 6297 |
|
6298 | 6298 | var result = optionalTarget || new Vector2();
|
6299 |
| - return result.subVectors( this.max, this.min ); |
| 6299 | + return this.isEmpty() ? result.set( 0, 0 ) : result.subVectors( this.max, this.min ); |
6300 | 6300 |
|
6301 | 6301 | },
|
6302 | 6302 |
|
|
7936 | 7936 |
|
7937 | 7937 | },
|
7938 | 7938 |
|
7939 |
| - center: function ( optionalTarget ) { |
| 7939 | + getCenter: function ( optionalTarget ) { |
7940 | 7940 |
|
7941 | 7941 | var result = optionalTarget || new Vector3();
|
7942 | 7942 | return this.isEmpty() ? result.set( 0, 0, 0 ) : result.addVectors( this.min, this.max ).multiplyScalar( 0.5 );
|
7943 | 7943 |
|
7944 | 7944 | },
|
7945 | 7945 |
|
7946 |
| - size: function ( optionalTarget ) { |
| 7946 | + getSize: function ( optionalTarget ) { |
7947 | 7947 |
|
7948 | 7948 | var result = optionalTarget || new Vector3();
|
7949 |
| - return result.subVectors( this.max, this.min ); |
| 7949 | + return this.isEmpty() ? result.set( 0, 0, 0 ) : result.subVectors( this.max, this.min ); |
7950 | 7950 |
|
7951 | 7951 | },
|
7952 | 7952 |
|
|
8129 | 8129 |
|
8130 | 8130 | var result = optionalTarget || new Sphere();
|
8131 | 8131 |
|
8132 |
| - result.center = this.center(); |
| 8132 | + result.center = this.getCenter(); |
8133 | 8133 | result.radius = this.size( v1 ).length() * 0.5;
|
8134 | 8134 |
|
8135 | 8135 | return result;
|
|
8251 | 8251 |
|
8252 | 8252 | } else {
|
8253 | 8253 |
|
8254 |
| - box.setFromPoints( points ).center( center ); |
| 8254 | + box.setFromPoints( points ).getCenter( center ); |
8255 | 8255 |
|
8256 | 8256 | }
|
8257 | 8257 |
|
|
11453 | 11453 |
|
11454 | 11454 | this.computeBoundingBox();
|
11455 | 11455 |
|
11456 |
| - var offset = this.boundingBox.center().negate(); |
| 11456 | + var offset = this.boundingBox.getCenter().negate(); |
11457 | 11457 |
|
11458 | 11458 | this.translate( offset.x, offset.y, offset.z );
|
11459 | 11459 |
|
|
12892 | 12892 |
|
12893 | 12893 | this.computeBoundingBox();
|
12894 | 12894 |
|
12895 |
| - var offset = this.boundingBox.center().negate(); |
| 12895 | + var offset = this.boundingBox.getCenter().negate(); |
12896 | 12896 |
|
12897 | 12897 | this.translate( offset.x, offset.y, offset.z );
|
12898 | 12898 |
|
|
13232 | 13232 | var center = this.boundingSphere.center;
|
13233 | 13233 |
|
13234 | 13234 | box.setFromArray( array );
|
13235 |
| - box.center( center ); |
| 13235 | + box.getCenter( center ); |
13236 | 13236 |
|
13237 | 13237 | // hoping to find a boundingSphere with a radius smaller than the
|
13238 | 13238 | // boundingSphere of the boundingBox: sqrt(3) smaller in the best case
|
@@ -26460,13 +26460,17 @@
|
26460 | 26460 |
|
26461 | 26461 | // flush last keyframe (compaction looks ahead)
|
26462 | 26462 |
|
26463 |
| - times[ writeIndex ] = times[ lastIndex ]; |
| 26463 | + if ( lastIndex > 0 ) { |
26464 | 26464 |
|
26465 |
| - for ( var readOffset = lastIndex * stride, writeOffset = writeIndex * stride, j = 0; j !== stride; ++ j ) |
| 26465 | + times[ writeIndex ] = times[ lastIndex ]; |
26466 | 26466 |
|
26467 |
| - values[ writeOffset + j ] = values[ readOffset + j ]; |
| 26467 | + for ( var readOffset = lastIndex * stride, writeOffset = writeIndex * stride, j = 0; j !== stride; ++ j ) |
26468 | 26468 |
|
26469 |
| - ++ writeIndex; |
| 26469 | + values[ writeOffset + j ] = values[ readOffset + j ]; |
| 26470 | + |
| 26471 | + ++ writeIndex; |
| 26472 | + |
| 26473 | + } |
26470 | 26474 |
|
26471 | 26475 | if ( writeIndex !== times.length ) {
|
26472 | 26476 |
|
|
40122 | 40126 |
|
40123 | 40127 | this.box.size( this.scale );
|
40124 | 40128 |
|
40125 |
| - this.box.center( this.position ); |
| 40129 | + this.box.getCenter( this.position ); |
40126 | 40130 |
|
40127 | 40131 | };
|
40128 | 40132 |
|
@@ -40757,17 +40761,29 @@
|
40757 | 40761 | //
|
40758 | 40762 |
|
40759 | 40763 | Object.assign( Box2.prototype, {
|
| 40764 | + center: function ( optionalTarget ) { |
| 40765 | + console.warn( 'THREE.Box2: .center() has been renamed to .getCenter().' ); |
| 40766 | + return this.getCenter( optionalTarget ); |
| 40767 | + }, |
40760 | 40768 | empty: function () {
|
40761 | 40769 | console.warn( 'THREE.Box2: .empty() has been renamed to .isEmpty().' );
|
40762 | 40770 | return this.isEmpty();
|
40763 | 40771 | },
|
40764 | 40772 | isIntersectionBox: function ( box ) {
|
40765 | 40773 | console.warn( 'THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox().' );
|
40766 | 40774 | return this.intersectsBox( box );
|
| 40775 | + }, |
| 40776 | + size: function ( optionalTarget ) { |
| 40777 | + console.warn( 'THREE.Box2: .size() has been renamed to .getSize().' ); |
| 40778 | + return this.getSize( optionalTarget ); |
40767 | 40779 | }
|
40768 | 40780 | } );
|
40769 | 40781 |
|
40770 | 40782 | Object.assign( Box3.prototype, {
|
| 40783 | + center: function ( optionalTarget ) { |
| 40784 | + console.warn( 'THREE.Box3: .center() has been renamed to .getCenter().' ); |
| 40785 | + return this.getCenter( optionalTarget ); |
| 40786 | + }, |
40771 | 40787 | empty: function () {
|
40772 | 40788 | console.warn( 'THREE.Box3: .empty() has been renamed to .isEmpty().' );
|
40773 | 40789 | return this.isEmpty();
|
|
40779 | 40795 | isIntersectionSphere: function ( sphere ) {
|
40780 | 40796 | console.warn( 'THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere().' );
|
40781 | 40797 | return this.intersectsSphere( sphere );
|
| 40798 | + }, |
| 40799 | + size: function ( optionalTarget ) { |
| 40800 | + console.warn( 'THREE.Box3: .size() has been renamed to .getSize().' ); |
| 40801 | + return this.getSize( optionalTarget ); |
40782 | 40802 | }
|
40783 | 40803 | } );
|
40784 | 40804 |
|
|
0 commit comments