@stringsync/vexml
Version:
MusicXML to Vexflow
36 lines (35 loc) • 619 B
JavaScript
import { Point } from './point';
export class Circle {
x;
y;
r;
constructor(
/** center x-coordinate */
x,
/** center y-coordinate */
y,
/** radius */
r) {
this.x = x;
this.y = y;
this.r = r;
}
center() {
return new Point(this.x, this.y);
}
contains(point) {
return this.center().distance(point) <= this.r;
}
left() {
return this.x - this.r;
}
right() {
return this.x + this.r;
}
top() {
return this.y - this.r;
}
bottom() {
return this.y + this.r;
}
}