12 lines
No EOL
348 B
TypeScript
12 lines
No EOL
348 B
TypeScript
// from spec
|
|
|
|
class Point {
|
|
constructor(public x: number, public y: number) { }
|
|
public distance(p: Point) {
|
|
var dx = this.x - p.x;
|
|
var dy = this.y - p.y;
|
|
return Math.sqrt(dx * dx + dy * dy);
|
|
}
|
|
static origin = new Point(0, 0);
|
|
static distance(p1: Point, p2: Point) { return p1.distance(p2); }
|
|
} |