Remove sameDir parameter from isCollinear() agian.

It's not in use anywhere now.
This commit is contained in:
Jürg Lehni 2016-01-06 11:08:17 +01:00
parent 5b98fea3fc
commit df580425f4
3 changed files with 9 additions and 13 deletions

View file

@ -113,9 +113,8 @@ var Line = Base.extend(/** @lends Line# */{
point.x, point.y, true));
},
isCollinear: function(line, sameDir) {
return Point.isCollinear(this._vx, this._vy, line._vx, line._vy,
sameDir);
isCollinear: function(line) {
return Point.isCollinear(this._vx, this._vy, line._vx, line._vy);
},
isOrthogonal: function(line) {

View file

@ -704,9 +704,8 @@ var Point = Base.extend(/** @lends Point# */{
* @return {Boolean} {@true it is collinear}
*/
isCollinear: function(/* point */) {
var point = Point.read(arguments),
sameDir = Base.read(arguments);
return Point.isCollinear(this.x, this.y, point.x, point.y, sameDir);
var point = Point.read(arguments);
return Point.isCollinear(this.x, this.y, point.x, point.y);
},
// TODO: Remove version with typo after a while (deprecated June 2015)
@ -918,16 +917,14 @@ var Point = Base.extend(/** @lends Point# */{
return new Point(Math.random(), Math.random());
},
isCollinear: function(x1, y1, x2, y2, sameDir) {
isCollinear: function(x1, y1, x2, y2) {
// NOTE: We use normalized vectors so that the epsilon comparison is
// reliable. We could instead scale the epsilon based on the vector
// length. But instead of normalizing the vectors before calculating
// the cross product, we can scale the epsilon accordingly.
var d2 = x2 * x2 + y2 * y2;
return Math.abs(x1 * y2 - y1 * x2)
<= Math.sqrt((x1 * x1 + y1 * y1) * d2)
* /*#=*/Numerical.TRIGONOMETRIC_EPSILON
&& (!sameDir || (x1 * x2 + y1 * y2) / d2 >= 0);
<= Math.sqrt((x1 * x1 + y1 * y1) * (x2 * x2 + y2 * y2))
* /*#=*/Numerical.TRIGONOMETRIC_EPSILON;
},
isOrthogonal: function(x1, y1, x2, y2) {

View file

@ -949,9 +949,9 @@ statics: {
* @param {Curve} curve the other curve to check against
* @return {Boolean} {@true if the two lines are collinear}
*/
isCollinear: function(curve, sameDir) {
isCollinear: function(curve) {
return curve && this.isStraight() && curve.isStraight()
&& this.getLine().isCollinear(curve.getLine(), sameDir);
&& this.getLine().isCollinear(curve.getLine());
},
/**