Просмотр исходного кода

Geometry.computeBoundingSphere clean up.

Mr.doob 13 лет назад
Родитель
Сommit
2913583ad5
1 измененных файлов с 7 добавлено и 5 удалено
  1. 7 5
      src/core/Geometry.js

+ 7 - 5
src/core/Geometry.js

@@ -544,15 +544,17 @@ THREE.Geometry.prototype = {
 
 	},
 
-	computeBoundingSphere: function ( skip ) {
+	computeBoundingSphere: function ( step ) {
 
-		if ( ! this.boundingSphere ) this.boundingSphere = { radius: 0 };
+		if ( this.boundingSphere === null ) this.boundingSphere = { radius: 0 };
 
-		var radiusSq, maxRadiusSq = 0, vs = skip || 1;
+		if ( step === undefined ) step = 1;
 
-		for ( var v = 0, vl = this.vertices.length; v < vl; v += vs ) {
+		var maxRadiusSq = 0;
 
-			radiusSq = this.vertices[ v ].lengthSq();
+		for ( var i = 0, l = this.vertices.length; i < l; i += step ) {
+
+			var radiusSq = this.vertices[ i ].lengthSq();
 			if ( radiusSq > maxRadiusSq ) maxRadiusSq = radiusSq;
 
 		}