JSVec2Array
An object for arrays of 2D coordinates.
Create a new Module.JSVec2Array API.
var vec_array = new Module.JSVec2Array();
Function
clear()
Initializes the vector list.
count() → number
Returns the number of vectors in the vector list.
Return
number: The number of vectors in the list.
get(index) → JSVector2D
Returns the vector object corresponding to the index.
index
number
The index of the vector to return.
Return
A valid vector object (JSVector2D): Successfully returns the vector at the specified index.
An initialized object (JSVector2D): If the index exceeds the size of the vector list.
pop() → JSVector2D
Returns the last vector in the vector list.
After returning, the last vector is deleted from the vector list.
Return
A valid vector object (JSVector2D): Successfully returns the last vector.
An initialized object (JSVector2D): If the vector list is empty.
push(element) → number
Adds a new vector (JSVector2D).
Return
number: The number of vectors in the list after adding the new vector.
pushXY(dX, dY) → number
Adds a new vector object using x, y values.
dX
number
The x property of the new vector.
dY
number
The y property of the new vector.
Return
number: The number of vectors in the list after adding the new vector.
set(index, vec)
Resets the value of the vector at the specified index.
index
number
The index of the vector to set.
setXY(index, dX, dY)
Resets the value of the vector at the specified index using x, y values.
index
number
The index of the vector to set.
dX
number
The x value to set for the vector.
dY
number
The y value to set for the vector.
shift()
Returns the first vector in the vector list and moves the order of the remaining vectors one position forward.
Return
A valid vector object (JSVector2D): Successfully returns the first vector.
An initialized object (JSVector2D): If the vector list is empty.
Last updated