class Point {
constructor(x, y) {
this.x = x;
this.y = y;
}
add(point) {
return new Point(this.x + point.x, this.y + point.y);
}
sub(point) {
return new Point(this.x - point.x, this.y - point.y);
}
}
var Point1 = Point;
function Point2(x, y) {
this.x = x;
this.y = y;
}
Point2.prototype.add = function(point) {
return new Point2(this.x + point.x, this.y + point.y);
}
Point2.prototype.sub = function(point) {
return new Point2(this.x - point.x, this.y - point.y);
}
function Point3(x, y) {
return {
x,
y,
add: (point) => Point3(this.x + point.x, this.y + point.y),
sub: (point) => Point3(this.x - point.x, this.y - point.y)
}
}
var add = (a, b) => Point3(a.x + b.x, a.y + b.y)
var sub = (a, b) => Point3(a.x - b.x, a.y - b.y)