Kaynağa Gözat

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

Mr.doob 9 yıl önce
ebeveyn
işleme
5578c057a9

+ 16 - 0
src/Three.Legacy.js

@@ -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 );
 	}
 } );
 

+ 2 - 2
src/core/BufferGeometry.js

@@ -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

+ 1 - 1
src/core/Geometry.js

@@ -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 );
 

+ 1 - 1
src/extras/helpers/BoundingBoxHelper.js

@@ -30,7 +30,7 @@ BoundingBoxHelper.prototype.update = function () {
 
 	this.box.size( this.scale );
 
-	this.box.center( this.position );
+	this.box.getCenter( this.position );
 
 };
 

+ 2 - 2
src/math/Box2.js

@@ -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 );

+ 3 - 3
src/math/Box3.js

@@ -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;

+ 1 - 1
src/math/Sphere.js

@@ -40,7 +40,7 @@ Sphere.prototype = {
 
 			} else {
 
-				box.setFromPoints( points ).center( center );
+				box.setFromPoints( points ).getCenter( center );
 
 			}