Skip to content

Commit 5578c05

Browse files
committed
Box2/Box3: Renamed center/size to getCenter/getSize. See mrdoob#9675.
1 parent 09c7789 commit 5578c05

File tree

7 files changed

+26
-10
lines changed

7 files changed

+26
-10
lines changed

src/Three.Legacy.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,29 @@ export function Vertex ( x, y, z ) {
8585
//
8686

8787
Object.assign( Box2.prototype, {
88+
center: function ( optionalTarget ) {
89+
console.warn( 'THREE.Box2: .center() has been renamed to .getCenter().' );
90+
return this.getCenter( optionalTarget );
91+
},
8892
empty: function () {
8993
console.warn( 'THREE.Box2: .empty() has been renamed to .isEmpty().' );
9094
return this.isEmpty();
9195
},
9296
isIntersectionBox: function ( box ) {
9397
console.warn( 'THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox().' );
9498
return this.intersectsBox( box );
99+
},
100+
size: function ( optionalTarget ) {
101+
console.warn( 'THREE.Box2: .size() has been renamed to .getSize().' );
102+
return this.getSize( optionalTarget );
95103
}
96104
} );
97105

98106
Object.assign( Box3.prototype, {
107+
center: function ( optionalTarget ) {
108+
console.warn( 'THREE.Box3: .center() has been renamed to .getCenter().' );
109+
return this.getCenter( optionalTarget );
110+
},
99111
empty: function () {
100112
console.warn( 'THREE.Box3: .empty() has been renamed to .isEmpty().' );
101113
return this.isEmpty();
@@ -107,6 +119,10 @@ Object.assign( Box3.prototype, {
107119
isIntersectionSphere: function ( sphere ) {
108120
console.warn( 'THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere().' );
109121
return this.intersectsSphere( sphere );
122+
},
123+
size: function ( optionalTarget ) {
124+
console.warn( 'THREE.Box3: .size() has been renamed to .getSize().' );
125+
return this.getSize( optionalTarget );
110126
}
111127
} );
112128

src/core/BufferGeometry.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ Object.assign( BufferGeometry.prototype, EventDispatcher.prototype, {
280280

281281
this.computeBoundingBox();
282282

283-
var offset = this.boundingBox.center().negate();
283+
var offset = this.boundingBox.getCenter().negate();
284284

285285
this.translate( offset.x, offset.y, offset.z );
286286

@@ -620,7 +620,7 @@ Object.assign( BufferGeometry.prototype, EventDispatcher.prototype, {
620620
var center = this.boundingSphere.center;
621621

622622
box.setFromArray( array );
623-
box.center( center );
623+
box.getCenter( center );
624624

625625
// hoping to find a boundingSphere with a radius smaller than the
626626
// boundingSphere of the boundingBox: sqrt(3) smaller in the best case

src/core/Geometry.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ Object.assign( Geometry.prototype, EventDispatcher.prototype, {
356356

357357
this.computeBoundingBox();
358358

359-
var offset = this.boundingBox.center().negate();
359+
var offset = this.boundingBox.getCenter().negate();
360360

361361
this.translate( offset.x, offset.y, offset.z );
362362

src/extras/helpers/BoundingBoxHelper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ BoundingBoxHelper.prototype.update = function () {
3030

3131
this.box.size( this.scale );
3232

33-
this.box.center( this.position );
33+
this.box.getCenter( this.position );
3434

3535
};
3636

src/math/Box2.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,14 @@ Box2.prototype = {
8686

8787
},
8888

89-
center: function ( optionalTarget ) {
89+
getCenter: function ( optionalTarget ) {
9090

9191
var result = optionalTarget || new Vector2();
9292
return this.isEmpty() ? result.set( 0, 0 ) : result.addVectors( this.min, this.max ).multiplyScalar( 0.5 );
9393

9494
},
9595

96-
size: function ( optionalTarget ) {
96+
getSize: function ( optionalTarget ) {
9797

9898
var result = optionalTarget || new Vector2();
9999
return this.isEmpty() ? result.set( 0, 0 ) : result.subVectors( this.max, this.min );

src/math/Box3.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,14 +201,14 @@ Box3.prototype = {
201201

202202
},
203203

204-
center: function ( optionalTarget ) {
204+
getCenter: function ( optionalTarget ) {
205205

206206
var result = optionalTarget || new Vector3();
207207
return this.isEmpty() ? result.set( 0, 0, 0 ) : result.addVectors( this.min, this.max ).multiplyScalar( 0.5 );
208208

209209
},
210210

211-
size: function ( optionalTarget ) {
211+
getSize: function ( optionalTarget ) {
212212

213213
var result = optionalTarget || new Vector3();
214214
return this.isEmpty() ? result.set( 0, 0, 0 ) : result.subVectors( this.max, this.min );
@@ -394,7 +394,7 @@ Box3.prototype = {
394394

395395
var result = optionalTarget || new Sphere();
396396

397-
result.center = this.center();
397+
result.center = this.getCenter();
398398
result.radius = this.size( v1 ).length() * 0.5;
399399

400400
return result;

src/math/Sphere.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Sphere.prototype = {
4040

4141
} else {
4242

43-
box.setFromPoints( points ).center( center );
43+
box.setFromPoints( points ).getCenter( center );
4444

4545
}
4646

0 commit comments

Comments
 (0)