|
@@ -18,12 +18,13 @@ function QuadraticBezierCurve( v0, v1, v2 ) {
|
|
QuadraticBezierCurve.prototype = Object.create( Curve.prototype );
|
|
QuadraticBezierCurve.prototype = Object.create( Curve.prototype );
|
|
QuadraticBezierCurve.prototype.constructor = QuadraticBezierCurve;
|
|
QuadraticBezierCurve.prototype.constructor = QuadraticBezierCurve;
|
|
|
|
|
|
-
|
|
|
|
QuadraticBezierCurve.prototype.getPoint = function ( t ) {
|
|
QuadraticBezierCurve.prototype.getPoint = function ( t ) {
|
|
|
|
|
|
|
|
+ var v0 = this.v0, v1 = this.v1, v2 = this.v2;
|
|
|
|
+
|
|
return new Vector2(
|
|
return new Vector2(
|
|
- QuadraticBezier( t, this.v0.x, this.v1.x, this.v2.x ),
|
|
|
|
- QuadraticBezier( t, this.v0.y, this.v1.y, this.v2.y )
|
|
|
|
|
|
+ QuadraticBezier( t, v0.x, v1.x, v2.x ),
|
|
|
|
+ QuadraticBezier( t, v0.y, v1.y, v2.y )
|
|
);
|
|
);
|
|
|
|
|
|
};
|
|
};
|
|
@@ -31,9 +32,11 @@ QuadraticBezierCurve.prototype.getPoint = function ( t ) {
|
|
|
|
|
|
QuadraticBezierCurve.prototype.getTangent = function ( t ) {
|
|
QuadraticBezierCurve.prototype.getTangent = function ( t ) {
|
|
|
|
|
|
|
|
+ var v0 = this.v0, v1 = this.v1, v2 = this.v2;
|
|
|
|
+
|
|
return new Vector2(
|
|
return new Vector2(
|
|
- TangentQuadraticBezier( t, this.v0.x, this.v1.x, this.v2.x ),
|
|
|
|
- TangentQuadraticBezier( t, this.v0.y, this.v1.y, this.v2.y )
|
|
|
|
|
|
+ TangentQuadraticBezier( t, v0.x, v1.x, v2.x ),
|
|
|
|
+ TangentQuadraticBezier( t, v0.y, v1.y, v2.y )
|
|
).normalize();
|
|
).normalize();
|
|
|
|
|
|
};
|
|
};
|