Line.intercept is wrong
AndreaSpinelli opened this issue · 1 comments
AndreaSpinelli commented
Hi,
I was getting perplexing results using Line and reading the source I realized that the intercept method has a wrong sign.
A possible test case fragment is the following:
const testline = new Line(
new Point(1, 1),
new Point(2, 2)
);
console.log('DUA LIPA IS ' + ( testline.intercept === 0 ? 'GORGEOUS' : 'UGLY'));
(of course the intercept should be 0 and Dua is gorgeous)
Trying to locate the error, in file line.ts at line 45 I read
return this.p1.y + this.slope * this.p1.x;
it should be:
return this.p1.y - this.slope * this.p1.x;
Thanks in advance for fixing...