mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Fix Line#isCollinear() and #isOrthogonal()
This commit is contained in:
parent
bcd6520e66
commit
140fba56cc
2 changed files with 7 additions and 9 deletions
|
@ -113,11 +113,11 @@ var Line = Base.extend(/** @lends Line# */{
|
|||
},
|
||||
|
||||
isCollinear: function(line) {
|
||||
return Point.isCollinear(this._vx, this._vy, line._vx, line._yy);
|
||||
return Point.isCollinear(this._vx, this._vy, line._vx, line._vy);
|
||||
},
|
||||
|
||||
isOrthogonal: function(line) {
|
||||
return Point.isOrthogonal(this._vx, this._vy, line._vx, line._yy);
|
||||
return Point.isOrthogonal(this._vx, this._vy, line._vx, line._vy);
|
||||
},
|
||||
|
||||
statics: /** @lends Line */{
|
||||
|
|
|
@ -394,14 +394,12 @@ var Curve = Base.extend(/** @lends Curve# */{
|
|||
},
|
||||
|
||||
/**
|
||||
* The total direction of the curve as a vector pointing from
|
||||
* {@link #point1} to {@link #point2}.
|
||||
*
|
||||
* @type Point
|
||||
* @type Line
|
||||
* @bean
|
||||
* @private
|
||||
*/
|
||||
getVector: function() {
|
||||
return this._segment2._point.subtract(this._segment1._point);
|
||||
getLine: function() {
|
||||
return new Line(this._segment1._point, this._segment2._point);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -960,7 +958,7 @@ statics: {
|
|||
*/
|
||||
isCollinear: function(curve) {
|
||||
return curve && this.isStraight() && curve.isStraight()
|
||||
&& this.getVector().isCollinear(curve.getVector());
|
||||
&& this.getLine().isCollinear(curve.getLine());
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue