Fix Line#isCollinear() and #isOrthogonal()

This commit is contained in:
Jürg Lehni 2015-10-20 23:37:37 +02:00
parent bcd6520e66
commit 140fba56cc
2 changed files with 7 additions and 9 deletions

View file

@ -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 */{

View file

@ -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());
},
/**