All files / src/geometry Point.ts

100% Statements 19/19
100% Branches 5/5
100% Functions 4/4
100% Lines 19/19

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 241x   1x 9037x 9037x   9037x 9037x 9037x 9037x 9037x   9037x 7231x 7231x   9037x 616x 616x 616x 616x 616x 9037x  
import { Shape } from './Shape.js';
 
export class Point extends Shape {
	public x: number;
	public y: number;
 
	constructor(x: number, y: number) {
		super();
		this.x = x;
		this.y = y;
	}
 
	public equal(point: Point): boolean {
		return point.x === this.x && point.y === this.y;
	}
 
	public transform(matrix: Array<number>): this {
		const p = Shape.applyTransform([this.x, this.y], matrix);
		this.x = p[0];
		this.y = p[1];
		return this;
	}
}