Browse Source

EllipseCurve: Added default parameter

Mugen87 7 years ago
parent
commit
516621ff72
2 changed files with 14 additions and 14 deletions
  1. 7 7
      docs/api/extras/curves/EllipseCurve.html
  2. 7 7
      src/extras/curves/EllipseCurve.js

+ 7 - 7
docs/api/extras/curves/EllipseCurve.html

@@ -42,13 +42,13 @@ var ellipse = new THREE.Line( geometry, material );
 
 		<h3>[name]( [page:Float aX], [page:Float aY], [page:Float xRadius], [page:Float yRadius], [page:Radians aStartAngle], [page:Radians aEndAngle], [page:Boolean aClockwise], [page:Radians aRotation] )</h3>
 		<div>
-			[page:Float aX] – The X center of the ellipse.<br/>
-			[page:Float aY] – The Y center of the ellipse.<br/>
-			[page:Float xRadius] – The radius of the ellipse in the x direction.<br/>
-			[page:Float yRadius] – The radius of the ellipse in the y direction.<br/>
-			[page:Radians aStartAngle] – The start angle of the curve in radians starting from the middle right side.<br/>
-			[page:Radians aEndAngle] – The end angle of the curve in radians starting from the middle right side.<br/>
-			[page:Boolean aClockwise] – Whether the ellipse is drawn clockwise.<br/>
+			[page:Float aX] – The X center of the ellipse. Default is *0*.<br/>
+			[page:Float aY] – The Y center of the ellipse. Default is *0*.<br/>
+			[page:Float xRadius] – The radius of the ellipse in the x direction. Default is *1*.<br/>
+			[page:Float yRadius] – The radius of the ellipse in the y direction. Default is *1*.<br/>
+			[page:Radians aStartAngle] – The start angle of the curve in radians starting from the middle right side.  Default is *0*.<br/>
+			[page:Radians aEndAngle] – The end angle of the curve in radians starting from the middle right side. Default is *2 x Math.PI*.<br/>
+			[page:Boolean aClockwise] – Whether the ellipse is drawn clockwise. Default is *false*.<br/>
 			[page:Radians aRotation]  – The rotation angle of the ellipse in radians, counterclockwise from the positive X axis (optional). Default is *0*.<br/><br/>
 
 			<em>Note:</em> When going clockwise it's best to set the start angle to (Math.PI * 2) and then work towards lower numbers.

+ 7 - 7
src/extras/curves/EllipseCurve.js

@@ -8,16 +8,16 @@ function EllipseCurve( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockw
 
 	this.type = 'EllipseCurve';
 
-	this.aX = aX;
-	this.aY = aY;
+	this.aX = aX || 0;
+	this.aY = aY || 0;
 
-	this.xRadius = xRadius;
-	this.yRadius = yRadius;
+	this.xRadius = xRadius || 1;
+	this.yRadius = yRadius || 1;
 
-	this.aStartAngle = aStartAngle;
-	this.aEndAngle = aEndAngle;
+	this.aStartAngle = aStartAngle || 0;
+	this.aEndAngle = aEndAngle || 2 * Math.PI;
 
-	this.aClockwise = aClockwise;
+	this.aClockwise = aClockwise || false;
 
 	this.aRotation = aRotation || 0;