12345678910111213141516171819 |
- export class Point {
- constructor(x, y){
- this.x = x;
- this.y = y;
- }
- scale(x, y) {
- this.x *= x;
- this.y *= y;
- }
- distanceTo(point) {
- return Math.hypot(point.x - this.x, point.y - this.y);
- }
- equals(point) {
- return point.x == this.x && point.y == this.y
- }
- }
|