Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Point

Hierarchy

  • Point

Index

Constructors

constructor

  • new Point(x: number, y: number, round?: boolean): Point
  • Creates a Point object with the given x and y coordinates. If optional round is set to true, rounds the x and y values.

    Parameters

    • x: number
    • y: number
    • Optional round: boolean

    Returns Point

Properties

x

x: number

The x coordinate.

y

y: number

The y coordinate.

Methods

add

  • Returns the result of addition of the current and the given points.

    Parameters

    Returns Point

clone

  • Returns a copy of the current point.

    Returns Point

distanceTo

  • distanceTo(otherPoint: Point): number
  • Returns the distance between the current and the given points.

    Parameters

    Returns number

divideBy

  • divideBy(number: number, round?: boolean): Point
  • Returns the result of division of the current point by the given number. If optional round is set to true, returns a rounded result.

    Parameters

    • number: number
    • Optional round: boolean

    Returns Point

equals

  • equals(otherPoint: Point): boolean
  • Returns true if the given point has the same coordinates.

    Parameters

    Returns boolean

multiplyBy

  • multiplyBy(number: number): Point
  • Returns the result of multiplication of the current point by the given number.

    Parameters

    • number: number

    Returns Point

round

  • Returns a copy of the current point with rounded coordinates.

    Returns Point

subtract

  • Returns the result of subtraction of the given point from the current.

    Parameters

    Returns Point

toString

  • toString(): string
  • Returns a string representation of the point for debugging purposes.

    Returns string