Vector2

Vector2 class

A vector with two components.

Properties

NameDescription
xThe x component.
yThe y component.

Methods

constructor

NameDescription
constructor()

Result:


constructor_overload

NameDescription
constructor_overload(s)Initializes a new instance of the Vector2 struct.

Parameters:

NameTypeDescription
sNumberS.

Result:


constructor_overload$2{#constructor_overload$2}

NameDescription
constructor_overload$2(vec)Initializes a new instance of the Vector2 struct.

Parameters:

NameTypeDescription
vecFVector2Vector in float.

Result:


constructor_overload$3{#constructor_overload$3}

NameDescription
constructor_overload$3(x, y)Initializes a new instance of the Vector2 struct.

Parameters:

NameTypeDescription
xNumberThe x coordinate.
yNumberThe y coordinate.

Result:


getU

NameDescription
getU()Gets or sets the U component if the Vector2 is used as a mapping coordinate. It’s an alias of x component.

Result:


setU

NameDescription
setU(value)Gets or sets the U component if the Vector2 is used as a mapping coordinate. It’s an alias of x component.

Result:


getV

NameDescription
getV()Gets or sets the V component if the Vector2 is used as a mapping coordinate. It’s an alias of y component.

Result:


setV

NameDescription
setV(value)Gets or sets the V component if the Vector2 is used as a mapping coordinate. It’s an alias of y component.

Result:


getLength

NameDescription
getLength()Gets the length. The length.

Result:


dot

NameDescription
dot(rhs)Gets the dot product of two vectors

Parameters:

NameTypeDescription
rhsVector2Right hand side value.

Result: Number


equals

NameDescription
equals(rhs)Check if two vector2 equals

Parameters:

NameTypeDescription
rhsVector2The right hand side value.

Result: boolean


hashCode

NameDescription
hashCode()Gets the hash code of Vector2

Result: Number


equals

NameDescription
equals(obj)Check if two vector2 equals

Parameters:

NameTypeDescription
objObjectThe object to compare.

Result: boolean


toString

NameDescription
toString()Returns a java.lang.String that represents the current Vector2.

Result: String


cross

NameDescription
cross(v)Cross product of two vectors

Parameters:

NameTypeDescription
Vector2null

Result: Number


normalize

NameDescription
normalize()Normalizes this instance.

Result: Vector2


compareTo

NameDescription
compareTo(other)Compare current vector to another instance.

Parameters:

NameTypeDescription
otheVector2null

Result: Number