Class: Coordinate2D

Coordinate2D(x, y)

2D Coordinates in LevelZ

Constructor

new Coordinate2D(x, y)

Constructs a new 2D Coordinate.
Parameters:
Name Type Description
x number The X Value
y number The Y Value
Source:
Example
new Coordinate2D(1, 2)

Extends

Classes

Coordinate2D

Members

dimension

Returns the dimension of this Coordinate.
Overrides:
Source:

magnitude

Returns the magnitude of this Coordinate.
Overrides:
Source:

x :number

The X value for this 2D Coordinate.
Type:
  • number
Source:

y :number

The Y value for this 2D Coordinate.
Type:
  • number
Source:

(static) zero

Returns a new 2D Coordinate with X and Y at `0`.
Source:

Methods

toString() → {string}

Returns the string representation of this 2D Coordinate.
Source:
Returns:
The string representation of this 2D Coordinate.
Type
string

(static) fromString(str) → {Coordinate2D}

Converts a string to a 2D Coordinate.
Parameters:
Name Type Description
str string The string to convert
Source:
Throws:
If the string is invalid.
Type
SyntaxError
Returns:
The 2D Coordinate
Type
Coordinate2D
Example
Coordinate2D.fromString('[1, 2]')