Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Point

Index

Constructors

constructor

  • new Point(x: number, y: number): Point
  • Default Point constructor by input parameters

    Parameters

    • x: number

      initial input {@link Number} x

    • y: number

      initial input {@link Number} y

    Returns Point

Properties

Private Readonly subscribers

subscribers: {} = ...

Type declaration

Private Readonly Static operands

operands: Point[] = ...

Methods

add

addBy

addScalar

  • addScalar(value: number): Point
  • Adds scalar value to this point

    chainable

    Parameters

    • value: number

    Returns Point

    thisArg

apply

  • Applies a function to each coordinate of this point and return a new point.

    Parameters

    • func: Processor<number | bigint, number>

      The function to apply to each coordinate.

    Returns Point

    A new point with the coordinates computed by the specified function

clone

distanceFrom

  • distanceFrom(point: Point): number

distanceTo

  • distanceTo(point: Point): number
  • Computes the distance between this point and another point.

    Parameters

    • point: Point

      The point to compute the distance with.

    Returns number

    The distance between the 2 points

divide

  • divide(value: number): Point
  • Divides this point by a value

    chainable

    Parameters

    • value: number

    Returns Point

    thisArg

divideBy

equal

  • equal(obj: any): boolean
  • Returns true if this point is equal to another one

    Parameters

    • obj: any

    Returns boolean

getX

  • getX(): number

getY

  • getY(): number

gt

  • gt(point: Point): boolean
  • Returns true if this point is greater another one

    Parameters

    Returns boolean

gte

  • gte(point: Point): boolean
  • Returns true if this point is greater than or equal to another one

    Parameters

    Returns boolean

length

  • length(): number

lerp

  • Returns new point which is the result of linear interpolation with this one and another one

    Parameters

    • point: Point
    • t: number = 0.5

      , position of interpolation, between 0 and 1 default 0.5

    Returns Point

lt

  • lt(point: Point): boolean
  • Returns true if this point is less than another one

    Parameters

    Returns boolean

lte

  • lte(point: Point): boolean
  • Returns true if this point is less than or equal to another one

    Parameters

    Returns boolean

max

midPointFrom

min

multiplyBy

negate

notify

  • notify(event: string): void

on

  • on(event: string, cb: any): void

rotate

scale

  • scale(value: number): Point
  • Scales this point by input value

    chainable

    Parameters

    • value: number

    Returns Point

    thisArg

setFromPoint

setX

setXY

  • setXY(x: number, y: number): Point

setY

squaredDistanceTo

  • squaredDistanceTo(point: Point): number
  • Computes the squared distance between this point and another point. Useful for optimizing things like comparing distances.

    Parameters

    • point: Point

      The point to compute the squared distance with.

    Returns number

    The squared distance between the 2 points

subtract

subtractBy

swap

  • swap(point: Point): void

toString

  • toString(): string
  • Returns string representation of this point

    Returns string

valueOf

  • valueOf(): number

Static checkPoint

  • checkPoint(value: Point): void

Static from

  • from(x: number, y: number): Point

Static fromPoint

Static isPoint

  • isPoint(value: any): boolean