mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Adjust #isCollinear() tolerance.
This commit is contained in:
parent
86fd33c7d5
commit
d656c96191
2 changed files with 6 additions and 2 deletions
|
@ -113,7 +113,10 @@ var Line = Base.extend(/** @lends Line# */{
|
|||
},
|
||||
|
||||
isCollinear: function(line) {
|
||||
return this._vx * line._vy - this._vy * line._vx < 1e-10;
|
||||
// TODO: Tests showed that 1e-10 might work well here, but we want to
|
||||
// keep it in sync with Point#isCollinear()
|
||||
return this._vx * line._vy - this._vy * line._vx
|
||||
< /*#=*/Numerical.TOLERANCE;
|
||||
},
|
||||
|
||||
statics: /** @lends Line */{
|
||||
|
|
|
@ -703,7 +703,8 @@ var Point = Base.extend(/** @lends Point# */{
|
|||
*/
|
||||
isCollinear: function(point) {
|
||||
// NOTE: Numerical.EPSILON is too small, breaking shape-path-shape
|
||||
// conversion test.
|
||||
// conversion test. But tolerance is probably too large?
|
||||
// TODO: Tests showed that 1e-10 might work well here.
|
||||
return Math.abs(this.cross(point)) < /*#=*/Numerical.TOLERANCE;
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue