@stringsync/vexml
Version:
MusicXML to Vexflow
19 lines (18 loc) • 395 B
JavaScript
/** Represents a point in 2D space. */
export class Point {
x;
y;
constructor(x, y) {
this.x = x;
this.y = y;
}
static origin() {
return new Point(0, 0);
}
distance(other) {
return Math.sqrt((this.x - other.x) ** 2 + (this.y - other.y) ** 2);
}
isEqual(other) {
return this.x === other.x && this.y === other.y;
}
}