Rename src/ to js/

This commit is contained in:
Manuel Vögele
2022-01-30 14:24:10 +01:00
parent 81acdc3e63
commit 57ed4d2cc5
18 changed files with 3 additions and 3 deletions
+21
View File
@@ -0,0 +1,21 @@
export class Line {
constructor(m, b) {
this.m = m;
this.b = b;
}
static fromPoints(p1, p2) {
// Bring line into y=mx+b form
const m = (p1.y - p2.y) / (p1.x - p2.x);
const b = p1.y - m * p1.x;
return new Line(m, b);
}
get isVertical() {
return !isFinite(this.m);
}
calcY(x) {
return this.m * x + this.b;
}
}