Browse Source

fix #2738 - bounding box is calculated incorrect if there is only one position vector.

Ben Houston 12 years ago
parent
commit
c60f006646
1 changed files with 7 additions and 1 deletions
  1. 7 1
      src/core/BufferGeometry.js

+ 7 - 1
src/core/BufferGeometry.js

@@ -82,7 +82,13 @@ THREE.BufferGeometry.prototype = {
 			var bb = this.boundingBox;
 			var x, y, z;
 
-			for ( var i = 0, il = positions.length; i < il; i += 3 ) {
+			if( positions.length >= 3 ) {
+				bb.min.x = bb.max.x = positions[ 0 ];
+				bb.min.y = bb.max.y = positions[ 1 ];
+				bb.min.z = bb.max.z = positions[ 2 ];
+			}
+
+			for ( var i = 3, il = positions.length; i < il; i += 3 ) {
 
 				x = positions[ i ];
 				y = positions[ i + 1 ];