diff --git a/src/path/Curve.js b/src/path/Curve.js index 1a583f30..c84fad64 100644 --- a/src/path/Curve.js +++ b/src/path/Curve.js @@ -314,6 +314,29 @@ var Curve = Base.extend(/** @lends Curve# */{ return this._segment1.isLinear(); }, + /** + * Checks if the the two curves describe lines that are collinear, meaning + * they run in parallel. + * + * @param {Curve} the other curve to check against + * @return {Boolean} {@true if the two lines are collinear} + * @see Segment#isCollinear(segment) + */ + isCollinear: function(curve) { + return this._segment1.isCollinear(curve._segment1); + }, + + /** + * Checks if the curve describes an orthogonal arc, as used in the + * construction of circles and ellipses. + * + * @return {Boolean} {@true if the curve describes an orthogonal arc} + * @see Segment#isOrthogonalArc() + */ + isOrthogonalArc: function() { + return this._segment1.isOrthogonalArc(); + }, + // DOCS: Curve#getIntersections() getIntersections: function(curve) { return Curve.filterIntersections(Curve.getIntersections( diff --git a/src/path/Path.js b/src/path/Path.js index 68b8095d..f51b861d 100644 --- a/src/path/Path.js +++ b/src/path/Path.js @@ -1418,7 +1418,7 @@ var Path = PathItem.extend(/** @lends Path# */{ } function isArc(i) { - return segments[i].isArc(); + return segments[i].isOrthogonalArc(); } function getDistance(i, j) { diff --git a/src/path/Segment.js b/src/path/Segment.js index 886f8c77..e483dd8b 100644 --- a/src/path/Segment.js +++ b/src/path/Segment.js @@ -268,8 +268,12 @@ var Segment = Base.extend(/** @lends Segment# */{ }, /** - * Returns true if the the two segments are the beginning of two lines and - * if these two lines are running parallel. + * Checks if the the two segments are the beginning of two lines that are + * collinear, meaning they run in parallel. + * + * @param {Segment} the other segment to check against + * @return {Boolean} {@true if the two lines are collinear} + * @see Curve#isCollinear(curve) */ isCollinear: function(segment) { var next1 = this.getNext(), @@ -283,6 +287,13 @@ var Segment = Base.extend(/** @lends Segment# */{ // TODO: Remove version with typo after a while (deprecated June 2015) isColinear: '#isCollinear', + /** + * Checks if the segment is connecting two lines that are orthogonal, + * meaning they connect at an 90° angle. + * + * @return {Boolean} {@true if the two lines connected by this segment are + * orthogonal} + */ isOrthogonal: function() { var prev = this.getPrevious(), next = this.getNext(); @@ -293,16 +304,20 @@ var Segment = Base.extend(/** @lends Segment# */{ }, /** - * Returns true if the segment at the given index is the beginning of an - * orthogonal arc segment. The code looks at the length of the handles and - * their relation to the distance to the imaginary corner point. If the - * relation is kappa, then it's an arc. + * Checks if the segment is the beginning of an orthogonal arc, as used in + * the construction of circles and ellipses. + * + * @return {Boolean} {@true if the segment is the beginning of an orthogonal + * arc} + * @see Curve#isOrthogonalArc() */ - isArc: function() { + isOrthogonalArc: function() { var next = this.getNext(), handle1 = this._handleOut, handle2 = next._handleIn, kappa = /*#=*/Numerical.KAPPA; + // Look at the length of the handles and their relation to the distance + // to the imaginary corner point and see if it their relation is kappa. if (handle1.isOrthogonal(handle2)) { var from = this._point, to = next._point, @@ -318,6 +333,9 @@ var Segment = Base.extend(/** @lends Segment# */{ return false; }, + // TODO: Remove a while (deprecated August 2015) + isArc: '#isOrthogonalArc', + _selectionState: 0, /**