Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "point"

Index

Interfaces

Variables

Constructor Functions

Distance Functions

Other Functions

Transform Functions

Variables

Const ORIGIN

ORIGIN: {} = Object.freeze({ x: 0, y: 0 })

The origin is the point at 0, 0. It cannot be modified.

Type declaration

Constructor Functions

from

  • from(x: number, y: number): Point
  • Creates a point from its X and Y coordinates.

    Parameters

    • x: number
    • y: number

    Returns Point

Distance Functions

chebyshev

distance

manhattan

Other Functions

ceil

  • ceil(point: Point): void
  • Rounds the coordinates in point up.

    This modifies point. Use ceiled to create a new point.

    Parameters

    Returns void

ceiled

  • ceiled(point: Point): { x: number; y: number }
  • Rounds the coordinates in point up.

    This creates a new point. Use ceil if you want to modify point instead.

    Parameters

    Returns { x: number; y: number }

    • x: number
    • y: number

clone

  • Creates a copy of point.

    Parameters

    Returns Point

equals

  • Determines whether p1 and p2 are equal.

    Points are considered equal if their X and Y coordinates are both equal.

    Parameters

    Returns boolean

floor

  • floor(point: Point): void
  • Rounds the coordinates in point down.

    This modifies point. Use floored to create a new point.

    Parameters

    Returns void

floored

  • floored(point: Point): { x: number; y: number }
  • Rounds the coordinates in point down.

    This creates a new point. Use floor if you want to modify point instead.

    Parameters

    Returns { x: number; y: number }

    • x: number
    • y: number

interpolate

  • interpolate(p1: Point, p2: Point, value: number): { x: number; y: number }
  • Interpolate a new point on the line between p1 and p2.

    Parameters

    Returns { x: number; y: number }

    • x: number
    • y: number

is

  • is(value: any): value is Point
  • Determines whether value is a Point.

    Parameters

    • value: any

    Returns value is Point

mooreNeighbours

relativeFrom

  • Parameters

    Returns Point

relativeTo

  • Parameters

    Returns Point

vonNeumannNeighbours

Transform Functions

translate

  • Translates point by vector.

    This modifies point. Use translated to create a new point.

    Parameters

    Returns void

translated

  • translated(point: Point, vector: Vector): { x: number; y: number }
  • Translates point by vector.

    This creates a new point. Use translate if you want to modify point instead.

    Parameters

    Returns { x: number; y: number }

    • x: number
    • y: number

Generated using TypeDoc