2
0
Эх сурвалжийг харах

*Path and Shape clean up.

Mr.doob 9 жил өмнө
parent
commit
01274d95cb

+ 21 - 26
src/extras/core/CurvePath.js

@@ -26,11 +26,13 @@ THREE.CurvePath.prototype.add = function ( curve ) {
 
 
 };
 };
 
 
+/*
 THREE.CurvePath.prototype.checkConnection = function() {
 THREE.CurvePath.prototype.checkConnection = function() {
 	// TODO
 	// TODO
 	// If the ending of curve is not connected to the starting
 	// If the ending of curve is not connected to the starting
 	// or the next curve, then, this is not a real path
 	// or the next curve, then, this is not a real path
 };
 };
+*/
 
 
 THREE.CurvePath.prototype.closePath = function() {
 THREE.CurvePath.prototype.closePath = function() {
 
 
@@ -61,7 +63,7 @@ THREE.CurvePath.prototype.getPoint = function( t ) {
 
 
 	var d = t * this.getLength();
 	var d = t * this.getLength();
 	var curveLengths = this.getCurveLengths();
 	var curveLengths = this.getCurveLengths();
-	var i = 0, diff, curve;
+	var i = 0;
 
 
 	// To think about boundaries points.
 	// To think about boundaries points.
 
 
@@ -69,8 +71,8 @@ THREE.CurvePath.prototype.getPoint = function( t ) {
 
 
 		if ( curveLengths[ i ] >= d ) {
 		if ( curveLengths[ i ] >= d ) {
 
 
-			diff = curveLengths[ i ] - d;
-			curve = this.curves[ i ];
+			var diff = curveLengths[ i ] - d;
+			var curve = this.curves[ i ];
 
 
 			var u = 1 - diff / curve.getLength();
 			var u = 1 - diff / curve.getLength();
 
 
@@ -90,8 +92,8 @@ THREE.CurvePath.prototype.getPoint = function( t ) {
 
 
 /*
 /*
 THREE.CurvePath.prototype.getTangent = function( t ) {
 THREE.CurvePath.prototype.getTangent = function( t ) {
-};*/
-
+};
+*/
 
 
 // We cannot use the default THREE.Curve getPoint() with getLength() because in
 // We cannot use the default THREE.Curve getPoint() with getLength() because in
 // THREE.Curve, getLength() depends on getPoint() but in THREE.CurvePath
 // THREE.Curve, getLength() depends on getPoint() but in THREE.CurvePath
@@ -121,9 +123,8 @@ THREE.CurvePath.prototype.getCurveLengths = function() {
 	// Push sums into cached array
 	// Push sums into cached array
 
 
 	var lengths = [], sums = 0;
 	var lengths = [], sums = 0;
-	var i, il = this.curves.length;
 
 
-	for ( i = 0; i < il; i ++ ) {
+	for ( var i = 0, l = this.curves.length; i < l; i ++ ) {
 
 
 		sums += this.curves[ i ].getLength();
 		sums += this.curves[ i ].getLength();
 		lengths.push( sums );
 		lengths.push( sums );
@@ -150,15 +151,13 @@ THREE.CurvePath.prototype.getBoundingBox = function () {
 	maxX = maxY = Number.NEGATIVE_INFINITY;
 	maxX = maxY = Number.NEGATIVE_INFINITY;
 	minX = minY = Number.POSITIVE_INFINITY;
 	minX = minY = Number.POSITIVE_INFINITY;
 
 
-	var p, i, il, sum;
-
 	var v3 = points[ 0 ] instanceof THREE.Vector3;
 	var v3 = points[ 0 ] instanceof THREE.Vector3;
 
 
-	sum = v3 ? new THREE.Vector3() : new THREE.Vector2();
+	var sum = v3 ? new THREE.Vector3() : new THREE.Vector2();
 
 
-	for ( i = 0, il = points.length; i < il; i ++ ) {
+	for ( var i = 0, l = points.length; i < l; i ++ ) {
 
 
-		p = points[ i ];
+		var p = points[ i ];
 
 
 		if ( p.x > maxX ) maxX = p.x;
 		if ( p.x > maxX ) maxX = p.x;
 		else if ( p.x < minX ) minX = p.x;
 		else if ( p.x < minX ) minX = p.x;
@@ -223,9 +222,10 @@ THREE.CurvePath.prototype.createGeometry = function( points ) {
 
 
 	var geometry = new THREE.Geometry();
 	var geometry = new THREE.Geometry();
 
 
-	for ( var i = 0; i < points.length; i ++ ) {
+	for ( var i = 0, l = points.length; i < l; i ++ ) {
 
 
-		geometry.vertices.push( new THREE.Vector3( points[ i ].x, points[ i ].y, points[ i ].z || 0 ) );
+		var point = points[ i ];
+		geometry.vertices.push( new THREE.Vector3( point.x, point.y, point.z || 0 ) );
 
 
 	}
 	}
 
 
@@ -249,7 +249,6 @@ THREE.CurvePath.prototype.addWrapPath = function ( bendpath ) {
 THREE.CurvePath.prototype.getTransformedPoints = function( segments, bends ) {
 THREE.CurvePath.prototype.getTransformedPoints = function( segments, bends ) {
 
 
 	var oldPts = this.getPoints( segments ); // getPoints getSpacedPoints
 	var oldPts = this.getPoints( segments ); // getPoints getSpacedPoints
-	var i, il;
 
 
 	if ( ! bends ) {
 	if ( ! bends ) {
 
 
@@ -257,7 +256,7 @@ THREE.CurvePath.prototype.getTransformedPoints = function( segments, bends ) {
 
 
 	}
 	}
 
 
-	for ( i = 0, il = bends.length; i < il; i ++ ) {
+	for ( var i = 0, l = bends.length; i < l; i ++ ) {
 
 
 		oldPts = this.getWrapPoints( oldPts, bends[ i ] );
 		oldPts = this.getWrapPoints( oldPts, bends[ i ] );
 
 
@@ -271,15 +270,13 @@ THREE.CurvePath.prototype.getTransformedSpacedPoints = function( segments, bends
 
 
 	var oldPts = this.getSpacedPoints( segments );
 	var oldPts = this.getSpacedPoints( segments );
 
 
-	var i, il;
-
 	if ( ! bends ) {
 	if ( ! bends ) {
 
 
 		bends = this.bends;
 		bends = this.bends;
 
 
 	}
 	}
 
 
-	for ( i = 0, il = bends.length; i < il; i ++ ) {
+	for ( var i = 0, l = bends.length; i < l; i ++ ) {
 
 
 		oldPts = this.getWrapPoints( oldPts, bends[ i ] );
 		oldPts = this.getWrapPoints( oldPts, bends[ i ] );
 
 
@@ -296,16 +293,14 @@ THREE.CurvePath.prototype.getWrapPoints = function ( oldPts, path ) {
 
 
 	var bounds = this.getBoundingBox();
 	var bounds = this.getBoundingBox();
 
 
-	var i, il, p, oldX, oldY, xNorm;
-
-	for ( i = 0, il = oldPts.length; i < il; i ++ ) {
+	for ( var i = 0, l = oldPts.length; i < l; i ++ ) {
 
 
-		p = oldPts[ i ];
+		var p = oldPts[ i ];
 
 
-		oldX = p.x;
-		oldY = p.y;
+		var oldX = p.x;
+		var oldY = p.y;
 
 
-		xNorm = oldX / bounds.maxX;
+		var xNorm = oldX / bounds.maxX;
 
 
 		// If using actual distance, for length > path, requires line extrusions
 		// If using actual distance, for length > path, requires line extrusions
 		//xNorm = path.getUtoTmapping(xNorm, oldX); // 3 styles. 1) wrap stretched. 2) wrap stretch by arc length 3) warp by actual distance
 		//xNorm = path.getUtoTmapping(xNorm, oldX); // 3 styles. 1) wrap stretched. 2) wrap stretch by arc length 3) warp by actual distance

+ 53 - 56
src/extras/core/Path.js

@@ -22,7 +22,6 @@ THREE.Path.prototype = Object.create( THREE.CurvePath.prototype );
 THREE.Path.prototype.constructor = THREE.Path;
 THREE.Path.prototype.constructor = THREE.Path;
 
 
 THREE.PathActions = {
 THREE.PathActions = {
-
 	MOVE_TO: 'moveTo',
 	MOVE_TO: 'moveTo',
 	LINE_TO: 'lineTo',
 	LINE_TO: 'lineTo',
 	QUADRATIC_CURVE_TO: 'quadraticCurveTo', // Bezier quadratic curve
 	QUADRATIC_CURVE_TO: 'quadraticCurveTo', // Bezier quadratic curve
@@ -41,9 +40,9 @@ THREE.Path.prototype.fromPoints = function ( vectors ) {
 
 
 	this.moveTo( vectors[ 0 ].x, vectors[ 0 ].y );
 	this.moveTo( vectors[ 0 ].x, vectors[ 0 ].y );
 
 
-	for ( var v = 1, vlen = vectors.length; v < vlen; v ++ ) {
+	for ( var i = 1, l = vectors.length; i < l; i ++ ) {
 
 
-		this.lineTo( vectors[ v ].x, vectors[ v ].y );
+		this.lineTo( vectors[ i ].x, vectors[ i ].y );
 
 
 	}
 	}
 
 
@@ -83,18 +82,19 @@ THREE.Path.prototype.quadraticCurveTo = function( aCPx, aCPy, aX, aY ) {
 	var x0 = lastargs[ lastargs.length - 2 ];
 	var x0 = lastargs[ lastargs.length - 2 ];
 	var y0 = lastargs[ lastargs.length - 1 ];
 	var y0 = lastargs[ lastargs.length - 1 ];
 
 
-	var curve = new THREE.QuadraticBezierCurve( new THREE.Vector2( x0, y0 ),
-												new THREE.Vector2( aCPx, aCPy ),
-												new THREE.Vector2( aX, aY ) );
+	var curve = new THREE.QuadraticBezierCurve(
+		new THREE.Vector2( x0, y0 ),
+		new THREE.Vector2( aCPx, aCPy ),
+		new THREE.Vector2( aX, aY )
+	);
+
 	this.curves.push( curve );
 	this.curves.push( curve );
 
 
 	this.actions.push( { action: THREE.PathActions.QUADRATIC_CURVE_TO, args: args } );
 	this.actions.push( { action: THREE.PathActions.QUADRATIC_CURVE_TO, args: args } );
 
 
 };
 };
 
 
-THREE.Path.prototype.bezierCurveTo = function( aCP1x, aCP1y,
-											   aCP2x, aCP2y,
-											   aX, aY ) {
+THREE.Path.prototype.bezierCurveTo = function( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY ) {
 
 
 	var args = Array.prototype.slice.call( arguments );
 	var args = Array.prototype.slice.call( arguments );
 
 
@@ -103,10 +103,13 @@ THREE.Path.prototype.bezierCurveTo = function( aCP1x, aCP1y,
 	var x0 = lastargs[ lastargs.length - 2 ];
 	var x0 = lastargs[ lastargs.length - 2 ];
 	var y0 = lastargs[ lastargs.length - 1 ];
 	var y0 = lastargs[ lastargs.length - 1 ];
 
 
-	var curve = new THREE.CubicBezierCurve( new THREE.Vector2( x0, y0 ),
-											new THREE.Vector2( aCP1x, aCP1y ),
-											new THREE.Vector2( aCP2x, aCP2y ),
-											new THREE.Vector2( aX, aY ) );
+	var curve = new THREE.CubicBezierCurve(
+		new THREE.Vector2( x0, y0 ),
+		new THREE.Vector2( aCP1x, aCP1y ),
+		new THREE.Vector2( aCP2x, aCP2y ),
+		new THREE.Vector2( aX, aY )
+	);
+
 	this.curves.push( curve );
 	this.curves.push( curve );
 
 
 	this.actions.push( { action: THREE.PathActions.BEZIER_CURVE_TO, args: args } );
 	this.actions.push( { action: THREE.PathActions.BEZIER_CURVE_TO, args: args } );
@@ -120,7 +123,7 @@ THREE.Path.prototype.splineThru = function( pts /*Array of Vector*/ ) {
 
 
 	var x0 = lastargs[ lastargs.length - 2 ];
 	var x0 = lastargs[ lastargs.length - 2 ];
 	var y0 = lastargs[ lastargs.length - 1 ];
 	var y0 = lastargs[ lastargs.length - 1 ];
-	//---
+
 	var npts = [ new THREE.Vector2( x0, y0 ) ];
 	var npts = [ new THREE.Vector2( x0, y0 ) ];
 	Array.prototype.push.apply( npts, pts );
 	Array.prototype.push.apply( npts, pts );
 
 
@@ -133,8 +136,7 @@ THREE.Path.prototype.splineThru = function( pts /*Array of Vector*/ ) {
 
 
 // FUTURE: Change the API or follow canvas API?
 // FUTURE: Change the API or follow canvas API?
 
 
-THREE.Path.prototype.arc = function ( aX, aY, aRadius,
-									  aStartAngle, aEndAngle, aClockwise ) {
+THREE.Path.prototype.arc = function ( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {
 
 
 	var lastargs = this.actions[ this.actions.length - 1 ].args;
 	var lastargs = this.actions[ this.actions.length - 1 ].args;
 	var x0 = lastargs[ lastargs.length - 2 ];
 	var x0 = lastargs[ lastargs.length - 2 ];
@@ -145,28 +147,24 @@ THREE.Path.prototype.arc = function ( aX, aY, aRadius,
 
 
  };
  };
 
 
- THREE.Path.prototype.absarc = function ( aX, aY, aRadius,
-									  aStartAngle, aEndAngle, aClockwise ) {
+ THREE.Path.prototype.absarc = function ( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {
 
 
 	this.absellipse( aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise );
 	this.absellipse( aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise );
 
 
  };
  };
 
 
-THREE.Path.prototype.ellipse = function ( aX, aY, xRadius, yRadius,
-									  aStartAngle, aEndAngle, aClockwise, aRotation ) {
+THREE.Path.prototype.ellipse = function ( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) {
 
 
 	var lastargs = this.actions[ this.actions.length - 1 ].args;
 	var lastargs = this.actions[ this.actions.length - 1 ].args;
 	var x0 = lastargs[ lastargs.length - 2 ];
 	var x0 = lastargs[ lastargs.length - 2 ];
 	var y0 = lastargs[ lastargs.length - 1 ];
 	var y0 = lastargs[ lastargs.length - 1 ];
 
 
-	this.absellipse( aX + x0, aY + y0, xRadius, yRadius,
-		aStartAngle, aEndAngle, aClockwise, aRotation );
+	this.absellipse( aX + x0, aY + y0, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation );
 
 
  };
  };
 
 
 
 
-THREE.Path.prototype.absellipse = function ( aX, aY, xRadius, yRadius,
-									  aStartAngle, aEndAngle, aClockwise, aRotation ) {
+THREE.Path.prototype.absellipse = function ( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) {
 
 
 	var args = [
 	var args = [
 		aX, aY,
 		aX, aY,
@@ -175,8 +173,8 @@ THREE.Path.prototype.absellipse = function ( aX, aY, xRadius, yRadius,
 		aClockwise,
 		aClockwise,
 		aRotation || 0 // aRotation is optional.
 		aRotation || 0 // aRotation is optional.
 	];
 	];
-	var curve = new THREE.EllipseCurve( aX, aY, xRadius, yRadius,
-									aStartAngle, aEndAngle, aClockwise, aRotation );
+
+	var curve = new THREE.EllipseCurve( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation );
 	this.curves.push( curve );
 	this.curves.push( curve );
 
 
 	var lastPoint = curve.getPoint( 1 );
 	var lastPoint = curve.getPoint( 1 );
@@ -225,17 +223,15 @@ THREE.Path.prototype.getPoints = function( divisions, closedPath ) {
 
 
 	var points = [];
 	var points = [];
 
 
-	var i, il, item, action, args;
 	var cpx, cpy, cpx2, cpy2, cpx1, cpy1, cpx0, cpy0,
 	var cpx, cpy, cpx2, cpy2, cpx1, cpy1, cpx0, cpy0,
-		laste, j,
-		t, tx, ty;
+		laste, tx, ty;
 
 
-	for ( i = 0, il = this.actions.length; i < il; i ++ ) {
+	for ( var i = 0, l = this.actions.length; i < l; i ++ ) {
 
 
-		item = this.actions[ i ];
+		var item = this.actions[ i ];
 
 
-		action = item.action;
-		args = item.args;
+		var action = item.action;
+		var args = item.args;
 
 
 		switch ( action ) {
 		switch ( action ) {
 
 
@@ -275,9 +271,9 @@ THREE.Path.prototype.getPoints = function( divisions, closedPath ) {
 
 
 			}
 			}
 
 
-			for ( j = 1; j <= divisions; j ++ ) {
+			for ( var j = 1; j <= divisions; j ++ ) {
 
 
-				t = j / divisions;
+				var t = j / divisions;
 
 
 				tx = THREE.Shape.Utils.b2( t, cpx0, cpx1, cpx );
 				tx = THREE.Shape.Utils.b2( t, cpx0, cpx1, cpx );
 				ty = THREE.Shape.Utils.b2( t, cpy0, cpy1, cpy );
 				ty = THREE.Shape.Utils.b2( t, cpy0, cpy1, cpy );
@@ -316,9 +312,9 @@ THREE.Path.prototype.getPoints = function( divisions, closedPath ) {
 			}
 			}
 
 
 
 
-			for ( j = 1; j <= divisions; j ++ ) {
+			for ( var j = 1; j <= divisions; j ++ ) {
 
 
-				t = j / divisions;
+				var t = j / divisions;
 
 
 				tx = THREE.Shape.Utils.b3( t, cpx0, cpx1, cpx2, cpx );
 				tx = THREE.Shape.Utils.b3( t, cpx0, cpx1, cpx2, cpx );
 				ty = THREE.Shape.Utils.b3( t, cpy0, cpy1, cpy2, cpy );
 				ty = THREE.Shape.Utils.b3( t, cpy0, cpy1, cpy2, cpy );
@@ -342,7 +338,7 @@ THREE.Path.prototype.getPoints = function( divisions, closedPath ) {
 
 
 			var spline = new THREE.SplineCurve( spts );
 			var spline = new THREE.SplineCurve( spts );
 
 
-			for ( j = 1; j <= n; j ++ ) {
+			for ( var j = 1; j <= n; j ++ ) {
 
 
 				points.push( spline.getPointAt( j / n ) );
 				points.push( spline.getPointAt( j / n ) );
 
 
@@ -361,9 +357,9 @@ THREE.Path.prototype.getPoints = function( divisions, closedPath ) {
 			var angle;
 			var angle;
 			var tdivisions = divisions * 2;
 			var tdivisions = divisions * 2;
 
 
-			for ( j = 1; j <= tdivisions; j ++ ) {
+			for ( var j = 1; j <= tdivisions; j ++ ) {
 
 
-				t = j / tdivisions;
+				var t = j / tdivisions;
 
 
 				if ( ! aClockwise ) {
 				if ( ! aClockwise ) {
 
 
@@ -402,15 +398,15 @@ THREE.Path.prototype.getPoints = function( divisions, closedPath ) {
 
 
 			var cos, sin;
 			var cos, sin;
 			if ( aRotation !== 0 ) {
 			if ( aRotation !== 0 ) {
-		
+
 				cos = Math.cos( aRotation );
 				cos = Math.cos( aRotation );
 				sin = Math.sin( aRotation );
 				sin = Math.sin( aRotation );
 
 
 			}
 			}
 
 
-			for ( j = 1; j <= tdivisions; j ++ ) {
+			for ( var j = 1; j <= tdivisions; j ++ ) {
 
 
-				t = j / tdivisions;
+				var t = j / tdivisions;
 
 
 				if ( ! aClockwise ) {
 				if ( ! aClockwise ) {
 
 
@@ -481,16 +477,14 @@ THREE.Path.prototype.toShapes = function( isCCW, noHoles ) {
 
 
 	function extractSubpaths( inActions ) {
 	function extractSubpaths( inActions ) {
 
 
-		var i, il, item, action, args;
-
 		var subPaths = [], lastPath = new THREE.Path();
 		var subPaths = [], lastPath = new THREE.Path();
 
 
-		for ( i = 0, il = inActions.length; i < il; i ++ ) {
+		for ( var i = 0, l = inActions.length; i < l; i ++ ) {
 
 
-			item = inActions[ i ];
+			var item = inActions[ i ];
 
 
-			args = item.args;
-			action = item.action;
+			var args = item.args;
+			var action = item.action;
 
 
 			if ( action === THREE.PathActions.MOVE_TO ) {
 			if ( action === THREE.PathActions.MOVE_TO ) {
 
 
@@ -523,7 +517,7 @@ THREE.Path.prototype.toShapes = function( isCCW, noHoles ) {
 
 
 		var shapes = [];
 		var shapes = [];
 
 
-		for ( var i = 0, il = inSubpaths.length; i < il; i ++ ) {
+		for ( var i = 0, l = inSubpaths.length; i < l; i ++ ) {
 
 
 			var tmpPath = inSubpaths[ i ];
 			var tmpPath = inSubpaths[ i ];
 
 
@@ -636,9 +630,7 @@ THREE.Path.prototype.toShapes = function( isCCW, noHoles ) {
 	newShapes[ mainIdx ] = undefined;
 	newShapes[ mainIdx ] = undefined;
 	newShapeHoles[ mainIdx ] = [];
 	newShapeHoles[ mainIdx ] = [];
 
 
-	var i, il;
-
-	for ( i = 0, il = subPaths.length; i < il; i ++ ) {
+	for ( var i = 0, l = subPaths.length; i < l; i ++ ) {
 
 
 		tmpPath = subPaths[ i ];
 		tmpPath = subPaths[ i ];
 		tmpPoints = tmpPath.getPoints();
 		tmpPoints = tmpPath.getPoints();
@@ -682,13 +674,16 @@ THREE.Path.prototype.toShapes = function( isCCW, noHoles ) {
 			betterShapeHoles[ sIdx ] = [];
 			betterShapeHoles[ sIdx ] = [];
 
 
 		}
 		}
+
 		for ( var sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {
 		for ( var sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {
 
 
 			var sho = newShapeHoles[ sIdx ];
 			var sho = newShapeHoles[ sIdx ];
+
 			for ( var hIdx = 0; hIdx < sho.length; hIdx ++ ) {
 			for ( var hIdx = 0; hIdx < sho.length; hIdx ++ ) {
 
 
 				var ho = sho[ hIdx ];
 				var ho = sho[ hIdx ];
 				var hole_unassigned = true;
 				var hole_unassigned = true;
+
 				for ( var s2Idx = 0; s2Idx < newShapes.length; s2Idx ++ ) {
 				for ( var s2Idx = 0; s2Idx < newShapes.length; s2Idx ++ ) {
 
 
 					if ( isPointInsidePolygon( ho.p, newShapes[ s2Idx ].p ) ) {
 					if ( isPointInsidePolygon( ho.p, newShapes[ s2Idx ].p ) ) {
@@ -727,13 +722,15 @@ THREE.Path.prototype.toShapes = function( isCCW, noHoles ) {
 
 
 	}
 	}
 
 
-	var tmpHoles, j, jl;
-	for ( i = 0, il = newShapes.length; i < il; i ++ ) {
+	var tmpHoles;
+
+	for ( var i = 0, il = newShapes.length; i < il; i ++ ) {
 
 
 		tmpShape = newShapes[ i ].s;
 		tmpShape = newShapes[ i ].s;
 		shapes.push( tmpShape );
 		shapes.push( tmpShape );
 		tmpHoles = newShapeHoles[ i ];
 		tmpHoles = newShapeHoles[ i ];
-		for ( j = 0, jl = tmpHoles.length; j < jl; j ++ ) {
+
+		for ( var j = 0, jl = tmpHoles.length; j < jl; j ++ ) {
 
 
 			tmpShape.holes.push( tmpHoles[ j ].h );
 			tmpShape.holes.push( tmpHoles[ j ].h );
 
 

+ 19 - 19
src/extras/core/Shape.js

@@ -12,6 +12,7 @@
 THREE.Shape = function () {
 THREE.Shape = function () {
 
 
 	THREE.Path.apply( this, arguments );
 	THREE.Path.apply( this, arguments );
+
 	this.holes = [];
 	this.holes = [];
 
 
 };
 };
@@ -23,8 +24,7 @@ THREE.Shape.prototype.constructor = THREE.Shape;
 
 
 THREE.Shape.prototype.extrude = function ( options ) {
 THREE.Shape.prototype.extrude = function ( options ) {
 
 
-	var extruded = new THREE.ExtrudeGeometry( this, options );
-	return extruded;
+	return new THREE.ExtrudeGeometry( this, options );
 
 
 };
 };
 
 
@@ -32,8 +32,7 @@ THREE.Shape.prototype.extrude = function ( options ) {
 
 
 THREE.Shape.prototype.makeGeometry = function ( options ) {
 THREE.Shape.prototype.makeGeometry = function ( options ) {
 
 
-	var geometry = new THREE.ShapeGeometry( this, options );
-	return geometry;
+	return new THREE.ShapeGeometry( this, options );
 
 
 };
 };
 
 
@@ -41,9 +40,9 @@ THREE.Shape.prototype.makeGeometry = function ( options ) {
 
 
 THREE.Shape.prototype.getPointsHoles = function ( divisions ) {
 THREE.Shape.prototype.getPointsHoles = function ( divisions ) {
 
 
-	var i, il = this.holes.length, holesPts = [];
+	var holesPts = [];
 
 
-	for ( i = 0; i < il; i ++ ) {
+	for ( var i = 0, l = this.holes.length; i < l; i ++ ) {
 
 
 		holesPts[ i ] = this.holes[ i ].getTransformedPoints( divisions, this.bends );
 		holesPts[ i ] = this.holes[ i ].getTransformedPoints( divisions, this.bends );
 
 
@@ -57,9 +56,9 @@ THREE.Shape.prototype.getPointsHoles = function ( divisions ) {
 
 
 THREE.Shape.prototype.getSpacedPointsHoles = function ( divisions ) {
 THREE.Shape.prototype.getSpacedPointsHoles = function ( divisions ) {
 
 
-	var i, il = this.holes.length, holesPts = [];
+	var holesPts = [];
 
 
-	for ( i = 0; i < il; i ++ ) {
+	for ( var i = 0, l = this.holes.length; i < l; i ++ ) {
 
 
 		holesPts[ i ] = this.holes[ i ].getTransformedSpacedPoints( divisions, this.bends );
 		holesPts[ i ] = this.holes[ i ].getTransformedSpacedPoints( divisions, this.bends );
 
 
@@ -95,17 +94,18 @@ THREE.Shape.prototype.extractPoints = function ( divisions ) {
 
 
 };
 };
 
 
-//
-// THREE.Shape.prototype.extractAllPointsWithBend = function ( divisions, bend ) {
-//
-// 	return {
-//
-// 		shape: this.transform( bend, divisions ),
-// 		holes: this.getPointsHoles( divisions, bend )
-//
-// 	};
-//
-// };
+/*
+THREE.Shape.prototype.extractAllPointsWithBend = function ( divisions, bend ) {
+
+	return {
+
+		shape: this.transform( bend, divisions ),
+		holes: this.getPointsHoles( divisions, bend )
+
+	};
+
+};
+*/
 
 
 // Get points of shape and holes (spaced by regular distance)
 // Get points of shape and holes (spaced by regular distance)