提交 5578c057 编写于 作者: M Mr.doob

Box2/Box3: Renamed center/size to getCenter/getSize. See #9675.

上级 09c77896
......@@ -85,6 +85,10 @@ export function Vertex ( x, y, z ) {
//
Object.assign( Box2.prototype, {
center: function ( optionalTarget ) {
console.warn( 'THREE.Box2: .center() has been renamed to .getCenter().' );
return this.getCenter( optionalTarget );
},
empty: function () {
console.warn( 'THREE.Box2: .empty() has been renamed to .isEmpty().' );
return this.isEmpty();
......@@ -92,10 +96,18 @@ Object.assign( Box2.prototype, {
isIntersectionBox: function ( box ) {
console.warn( 'THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox().' );
return this.intersectsBox( box );
},
size: function ( optionalTarget ) {
console.warn( 'THREE.Box2: .size() has been renamed to .getSize().' );
return this.getSize( optionalTarget );
}
} );
Object.assign( Box3.prototype, {
center: function ( optionalTarget ) {
console.warn( 'THREE.Box3: .center() has been renamed to .getCenter().' );
return this.getCenter( optionalTarget );
},
empty: function () {
console.warn( 'THREE.Box3: .empty() has been renamed to .isEmpty().' );
return this.isEmpty();
......@@ -107,6 +119,10 @@ Object.assign( Box3.prototype, {
isIntersectionSphere: function ( sphere ) {
console.warn( 'THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere().' );
return this.intersectsSphere( sphere );
},
size: function ( optionalTarget ) {
console.warn( 'THREE.Box3: .size() has been renamed to .getSize().' );
return this.getSize( optionalTarget );
}
} );
......
......@@ -280,7 +280,7 @@ Object.assign( BufferGeometry.prototype, EventDispatcher.prototype, {
this.computeBoundingBox();
var offset = this.boundingBox.center().negate();
var offset = this.boundingBox.getCenter().negate();
this.translate( offset.x, offset.y, offset.z );
......@@ -620,7 +620,7 @@ Object.assign( BufferGeometry.prototype, EventDispatcher.prototype, {
var center = this.boundingSphere.center;
box.setFromArray( array );
box.center( center );
box.getCenter( center );
// hoping to find a boundingSphere with a radius smaller than the
// boundingSphere of the boundingBox: sqrt(3) smaller in the best case
......
......@@ -356,7 +356,7 @@ Object.assign( Geometry.prototype, EventDispatcher.prototype, {
this.computeBoundingBox();
var offset = this.boundingBox.center().negate();
var offset = this.boundingBox.getCenter().negate();
this.translate( offset.x, offset.y, offset.z );
......
......@@ -30,7 +30,7 @@ BoundingBoxHelper.prototype.update = function () {
this.box.size( this.scale );
this.box.center( this.position );
this.box.getCenter( this.position );
};
......
......@@ -86,14 +86,14 @@ Box2.prototype = {
},
center: function ( optionalTarget ) {
getCenter: function ( optionalTarget ) {
var result = optionalTarget || new Vector2();
return this.isEmpty() ? result.set( 0, 0 ) : result.addVectors( this.min, this.max ).multiplyScalar( 0.5 );
},
size: function ( optionalTarget ) {
getSize: function ( optionalTarget ) {
var result = optionalTarget || new Vector2();
return this.isEmpty() ? result.set( 0, 0 ) : result.subVectors( this.max, this.min );
......
......@@ -201,14 +201,14 @@ Box3.prototype = {
},
center: function ( optionalTarget ) {
getCenter: function ( optionalTarget ) {
var result = optionalTarget || new Vector3();
return this.isEmpty() ? result.set( 0, 0, 0 ) : result.addVectors( this.min, this.max ).multiplyScalar( 0.5 );
},
size: function ( optionalTarget ) {
getSize: function ( optionalTarget ) {
var result = optionalTarget || new Vector3();
return this.isEmpty() ? result.set( 0, 0, 0 ) : result.subVectors( this.max, this.min );
......@@ -394,7 +394,7 @@ Box3.prototype = {
var result = optionalTarget || new Sphere();
result.center = this.center();
result.center = this.getCenter();
result.radius = this.size( v1 ).length() * 0.5;
return result;
......
......@@ -40,7 +40,7 @@ Sphere.prototype = {
} else {
box.setFromPoints( points ).center( center );
box.setFromPoints( points ).getCenter( center );
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册