Class: Vector2D

graphics.geom. Vector2D


new Vector2D(x, y)

A simple location in a two-dimensional coordinate system, where x represents the horizontal axis and y represents the vertical axis.

The Vector2D class represents a simple location in a two-dimensional coordinate system, where x represents the horizontal axis and y represents the vertical axis.

Parameters:
Name Type Description
x number

The x value of the object.

y number

The y value of the object.

See:

Members


x :Number

The horizontal coordinate of the point.

Type:
  • Number
Default Value:
  • 0

y :Number

The vertical coordinate of the point.

Type:
  • Number
Default Value:
  • 0

Methods


clone()

Returns a shallow copy of the object.

Returns:

a shallow copy of the object.


copyFrom(source)

Copies all of vector data from the source Vector2D object into the calling Vector2D object.

Parameters:
Name Type Description
source graphics.geom.Vector2D

The Vector2D object from which to copy the data.

Returns:

The current graphics.geom.Vector2D reference.


equals()

Compares the passed-in object with this object for equality.

Returns:

true if the the specified object is equal with this object.

Type
boolean

setTo( [x] [, y])

Sets the horizontal and vertical coordinates of this object. If the x and the y parameters are NaN or null the x and y value are 0.

Parameters:
Name Type Argument Default Description
x number <optional>
0

The horizontal coordinate of the point.

y number <optional>
0

The vertical coordinate of the point.


toObject()

Returns the Object representation of this object.

Returns:

the Object representation of this object.


toString()

Returns the string representation of this instance.

Returns:

The string representation of this instance.

Type
string