Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "line"

Index

Interfaces

Constructor Functions

Length Functions

Other Functions

Constructor Functions

from

  • from(x1: number, y1: number, x2: number, y2: number): Line
  • Creates a line from the coordinates of its start and end.

    Parameters

    • x1: number
    • y1: number
    • x2: number
    • y2: number

    Returns Line

fromPoints

  • Creates a line from start and end points.

    Parameters

    Returns Line

Length Functions

chebyshev

  • chebyshev(line: Line): number
  • Calculates the Chebyshev distance between the end points of line.

    Parameters

    Returns number

length

  • length(line: Line): number
  • Calculates the Euclidean distance between the end points of line.

    Parameters

    Returns number

manhattan

  • manhattan(line: Line): number
  • Calculates the Manhattan distance between the end points of line.

    Parameters

    Returns number

Other Functions

center

  • Gets the center point of line.

    Parameters

    Returns Point

clone

  • Creates a copy of line.

    Parameters

    Returns Line

end

  • Get the end point of line.

    Parameters

    Returns Point

equals

  • Determines whether l1 and l2 are equal.

    Lines are considered equal if they have the same start and end points.

    Parameters

    Returns boolean

is

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

    Parameters

    • value: any

    Returns value is Line

start

  • Gets the start point of line.

    Parameters

    Returns Point

translate

  • Translates line by vector.

    This modifies line. Use translated if you want to create a new line instead.

    Parameters

    Returns void

translated

  • Translates line by vector.

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

    Parameters

    Returns Line

Generated using TypeDoc