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) { 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) { 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 */{ 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 * @type Line
* {@link #point1} to {@link #point2}.
*
* @type Point
* @bean * @bean
* @private
*/ */
getVector: function() { getLine: function() {
return this._segment2._point.subtract(this._segment1._point); return new Line(this._segment1._point, this._segment2._point);
}, },
/** /**
@ -960,7 +958,7 @@ statics: {
*/ */
isCollinear: function(curve) { isCollinear: function(curve) {
return curve && this.isStraight() && curve.isStraight() return curve && this.isStraight() && curve.isStraight()
&& this.getVector().isCollinear(curve.getVector()); && this.getLine().isCollinear(curve.getLine());
}, },
/** /**