mirror of
https://github.com/billsonnn/nitro-imager
synced 2024-10-01 11:10:29 +02:00
37 lines
579 B
TypeScript
37 lines
579 B
TypeScript
|
export class Point
|
||
|
{
|
||
|
public x = 0;
|
||
|
public y = 0;
|
||
|
|
||
|
constructor(x: number = 0, y: number = 0)
|
||
|
{
|
||
|
this.x = x;
|
||
|
this.y = y;
|
||
|
}
|
||
|
|
||
|
public clone(): Point
|
||
|
{
|
||
|
return new Point(this.x, this.y);
|
||
|
}
|
||
|
|
||
|
public copyFrom(p: Point): Point
|
||
|
{
|
||
|
this.add(p.x, p.y);
|
||
|
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
public equals(p: Point): boolean
|
||
|
{
|
||
|
return ((p.x === this.x) && (p.y === this.y));
|
||
|
}
|
||
|
|
||
|
public set(x: number = 0, y: number = x): Point
|
||
|
{
|
||
|
this.x = x;
|
||
|
this.y = y;
|
||
|
|
||
|
return this;
|
||
|
}
|
||
|
}
|