浏览代码

Remove duplicated Box3.addPoint.

resolves mrdoob/three.js#4848
Jan Wrobel 11 年之前
父节点
当前提交
0a3ee86c8c
共有 3 个文件被更改,包括 2 次插入47 次删除
  1. 0 9
      docs/api/math/Box3.html
  2. 1 1
      src/core/BufferGeometry.js
  3. 1 37
      src/math/Box3.js

+ 0 - 9
docs/api/math/Box3.html

@@ -51,15 +51,6 @@
 		Sets the lower and upper (x, y, z) boundaries of this box.
 		</div>
 		
-		<h3>.addPoint([page:Vector3 point]) [page:Box3 this]</h3>
-		<div>
-		point -- [page:Vector3] to add to the box <br />
-		</div>
-		<div>
-		If the *point* is outside the bounds of the box, the bounds are expanded
-		so that the point is within the bounds.
-		</div>
-		
 		<h3>.applyMatrix4([page:Matrix4 matrix]) [page:Box3 this]</h3>
 		<div>
 		matrix -- The [page:Matrix4] to apply

+ 1 - 1
src/core/BufferGeometry.js

@@ -329,7 +329,7 @@ THREE.BufferGeometry.prototype = {
 				for ( var i = 0, il = positions.length; i < il; i += 3 ) {
 
 					vector.set( positions[ i ], positions[ i + 1 ], positions[ i + 2 ] );
-					box.addPoint( vector );
+					box.expandByPoint( vector );
 
 				}
 

+ 1 - 37
src/math/Box3.js

@@ -23,42 +23,6 @@ THREE.Box3.prototype = {
 
 	},
 
-	addPoint: function ( point ) {
-
-		if ( point.x < this.min.x ) {
-
-			this.min.x = point.x;
-
-		} else if ( point.x > this.max.x ) {
-
-			this.max.x = point.x;
-
-		}
-
-		if ( point.y < this.min.y ) {
-
-			this.min.y = point.y;
-
-		} else if ( point.y > this.max.y ) {
-
-			this.max.y = point.y;
-
-		}
-
-		if ( point.z < this.min.z ) {
-
-			this.min.z = point.z;
-
-		} else if ( point.z > this.max.z ) {
-
-			this.max.z = point.z;
-
-		}
-		
-		return this;
-
-	},
-
 	setFromPoints: function ( points ) {
 
 		if ( points.length > 0 ) {
@@ -70,7 +34,7 @@ THREE.Box3.prototype = {
 
 			for ( var i = 1, il = points.length; i < il; i ++ ) {
 
-				this.addPoint( points[ i ] )
+				this.expandByPoint( points[ i ] )
 
 			}