packageDocumentation module import { PointProps } from "@itwin/appui-abstract" ; internal export class Point implements PointProps { /** Creates point from [[PointProps]]. */ public static create ( pointProps ) { return new Point ( pointProps . x , pointProps . y ) ; } /** Creates a new point. */ public constructor ( public readonly x = 0 , public readonly y = 0 ) { } /** Calculates Euclidean distance to other point. */ public getDistanceTo ( other ) { const offset = this . getOffsetTo ( other ) ; return Math . sqrt ( Math . pow ( offset . x , 2 ) + Math . pow ( offset . y , 2 ) ) ; } /** Calculates grid-like distance to other point. */ public getManhattanDistanceTo ( other ) { return Math . abs ( this . x - other . x ) + Math . abs ( this . y - other . y ) ; } /** Gets offset to other point. */ public getOffsetTo ( other ) { return new Point ( other . x - this . x , other . y - this . y ) ; } returns public offset ( offset ) { return new Point ( this . x + offset . x , this . y + offset . y ) ; } returns public offsetX ( offset ) { return new Point ( this . x + offset , this . y ) ; } returns public offsetY ( offset ) { return new Point ( this . x , this . y + offset ) ; } returns public equals ( other ) { return other . x === this . x && other . y === this . y ; } returns public setX ( x ) { return new Point ( x , this . y ) ; } returns public setY ( y ) { return new Point ( this . x , y ) ; } returns public multiply ( factor ) { return new Point ( this . x * factor , this . y * factor ) ; } returns public toProps ( ) { return { x : this . x , y : this . y } ; } }