Mr.doob před 4 roky
rodič
revize
330b18605a

+ 3 - 0
src/extras/curves/CatmullRomCurve3.js

@@ -181,6 +181,7 @@ class CatmullRomCurve3 extends Curve {
 		return point;
 
 	}
+
 	copy( source ) {
 
 		super.copy( source );
@@ -202,6 +203,7 @@ class CatmullRomCurve3 extends Curve {
 		return this;
 
 	}
+
 	toJSON() {
 
 		const data = super.toJSON();
@@ -222,6 +224,7 @@ class CatmullRomCurve3 extends Curve {
 		return data;
 
 	}
+
 	fromJSON( json ) {
 
 		super.fromJSON( json );

+ 3 - 0
src/extras/curves/CubicBezierCurve.js

@@ -32,6 +32,7 @@ class CubicBezierCurve extends Curve {
 		return point;
 
 	}
+
 	copy( source ) {
 
 		super.copy( source );
@@ -44,6 +45,7 @@ class CubicBezierCurve extends Curve {
 		return this;
 
 	}
+
 	toJSON() {
 
 		const data = super.toJSON();
@@ -56,6 +58,7 @@ class CubicBezierCurve extends Curve {
 		return data;
 
 	}
+
 	fromJSON( json ) {
 
 		super.fromJSON( json );

+ 4 - 0
src/extras/curves/CubicBezierCurve3.js

@@ -17,6 +17,7 @@ class CubicBezierCurve3 extends Curve {
 		this.v3 = v3;
 
 	}
+
 	getPoint( t, optionalTarget = new Vector3() ) {
 
 		const point = optionalTarget;
@@ -32,6 +33,7 @@ class CubicBezierCurve3 extends Curve {
 		return point;
 
 	}
+
 	copy( source ) {
 
 		super.copy( source );
@@ -44,6 +46,7 @@ class CubicBezierCurve3 extends Curve {
 		return this;
 
 	}
+
 	toJSON() {
 
 		const data = super.toJSON();
@@ -56,6 +59,7 @@ class CubicBezierCurve3 extends Curve {
 		return data;
 
 	}
+
 	fromJSON( json ) {
 
 		super.fromJSON( json );

+ 13 - 9
src/extras/curves/EllipseCurve.js

@@ -3,27 +3,28 @@ import { Vector2 } from '../../math/Vector2.js';
 
 class EllipseCurve extends Curve {
 
-	constructor( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) {
+	constructor( aX = 0, aY = 0, xRadius = 1, yRadius = 1, aStartAngle = 0, aEndAngle = Math.PI * 2, aClockwise = false, aRotation = 0 ) {
 
 		super();
 
 		this.type = 'EllipseCurve';
 		this.isEllipseCurve = true;
 
-		this.aX = aX || 0;
-		this.aY = aY || 0;
+		this.aX = aX;
+		this.aY = aY;
 
-		this.xRadius = xRadius || 1;
-		this.yRadius = yRadius || 1;
+		this.xRadius = xRadius;
+		this.yRadius = yRadius;
 
-		this.aStartAngle = aStartAngle || 0;
-		this.aEndAngle = aEndAngle || 2 * Math.PI;
+		this.aStartAngle = aStartAngle;
+		this.aEndAngle = aEndAngle;
 
-		this.aClockwise = aClockwise || false;
+		this.aClockwise = aClockwise;
 
-		this.aRotation = aRotation || 0;
+		this.aRotation = aRotation;
 
 	}
+
 	getPoint( t, optionalTarget ) {
 
 		const point = optionalTarget || new Vector2();
@@ -85,6 +86,7 @@ class EllipseCurve extends Curve {
 		return point.set( x, y );
 
 	}
+
 	copy( source ) {
 
 		super.copy( source );
@@ -105,6 +107,7 @@ class EllipseCurve extends Curve {
 		return this;
 
 	}
+
 	toJSON() {
 
 		const data = super.toJSON();
@@ -125,6 +128,7 @@ class EllipseCurve extends Curve {
 		return data;
 
 	}
+
 	fromJSON( json ) {
 
 		super.fromJSON( json );

+ 6 - 0
src/extras/curves/LineCurve.js

@@ -14,6 +14,7 @@ class LineCurve extends Curve {
 		this.v2 = v2;
 
 	}
+
 	getPoint( t, optionalTarget = new Vector2() ) {
 
 		const point = optionalTarget;
@@ -32,12 +33,14 @@ class LineCurve extends Curve {
 		return point;
 
 	}
+
 	// Line curve is linear, so we can overwrite default getPointAt
 	getPointAt( u, optionalTarget ) {
 
 		return this.getPoint( u, optionalTarget );
 
 	}
+
 	getTangent( t, optionalTarget ) {
 
 		const tangent = optionalTarget || new Vector2();
@@ -47,6 +50,7 @@ class LineCurve extends Curve {
 		return tangent;
 
 	}
+
 	copy( source ) {
 
 		super.copy( source );
@@ -57,6 +61,7 @@ class LineCurve extends Curve {
 		return this;
 
 	}
+
 	toJSON() {
 
 		const data = super.toJSON();
@@ -67,6 +72,7 @@ class LineCurve extends Curve {
 		return data;
 
 	}
+
 	fromJSON( json ) {
 
 		super.fromJSON( json );

+ 4 - 0
src/extras/curves/QuadraticBezierCurve.js

@@ -16,6 +16,7 @@ class QuadraticBezierCurve extends Curve {
 		this.v2 = v2;
 
 	}
+
 	getPoint( t, optionalTarget = new Vector2() ) {
 
 		const point = optionalTarget;
@@ -30,6 +31,7 @@ class QuadraticBezierCurve extends Curve {
 		return point;
 
 	}
+
 	copy( source ) {
 
 		super.copy( source );
@@ -41,6 +43,7 @@ class QuadraticBezierCurve extends Curve {
 		return this;
 
 	}
+
 	toJSON() {
 
 		const data = super.toJSON();
@@ -52,6 +55,7 @@ class QuadraticBezierCurve extends Curve {
 		return data;
 
 	}
+
 	fromJSON( json ) {
 
 		super.fromJSON( json );

+ 4 - 0
src/extras/curves/QuadraticBezierCurve3.js

@@ -16,6 +16,7 @@ class QuadraticBezierCurve3 extends Curve {
 		this.v2 = v2;
 
 	}
+
 	getPoint( t, optionalTarget = new Vector3() ) {
 
 		const point = optionalTarget;
@@ -31,6 +32,7 @@ class QuadraticBezierCurve3 extends Curve {
 		return point;
 
 	}
+
 	copy( source ) {
 
 		super.copy( source );
@@ -42,6 +44,7 @@ class QuadraticBezierCurve3 extends Curve {
 		return this;
 
 	}
+
 	toJSON() {
 
 		const data = super.toJSON();
@@ -53,6 +56,7 @@ class QuadraticBezierCurve3 extends Curve {
 		return data;
 
 	}
+
 	fromJSON( json ) {
 
 		super.fromJSON( json );

+ 7 - 3
src/extras/curves/SplineCurve.js

@@ -14,6 +14,7 @@ class SplineCurve extends Curve {
 		this.points = points;
 
 	}
+
 	getPoint( t, optionalTarget = new Vector2() ) {
 
 		const point = optionalTarget;
@@ -37,9 +38,10 @@ class SplineCurve extends Curve {
 		return point;
 
 	}
+
 	copy( source ) {
 
-		Curve.prototype.copy.call( this, source );
+		super.copy( source );
 
 		this.points = [];
 
@@ -54,9 +56,10 @@ class SplineCurve extends Curve {
 		return this;
 
 	}
+
 	toJSON() {
 
-		const data = Curve.prototype.toJSON.call( this );
+		const data = super.toJSON();
 
 		data.points = [];
 
@@ -70,9 +73,10 @@ class SplineCurve extends Curve {
 		return data;
 
 	}
+
 	fromJSON( json ) {
 
-		Curve.prototype.fromJSON.call( this, json );
+		super.fromJSON( json );
 
 		this.points = [];