Vector
A vector is a mathematical tool used to represent quantities that have both magnitude (size or value) and direction. Vectors are essential for describing and manipulating various aspects of a robot's motion and behavior. The blocks in this section allow you to create vector objects, manipulate these objects, and obtain information from these objects.
length
Returns the length of a given vector object.
Magnitude
Returns the magnitude of a given vector object. Magnitude represents the vector’s length or size, regardless of its direction. It's calculated using the Pythagorean theorem.
get
Returns a particular of a given vector specified by the index value. Index starts from 0.
put
Update the given vector by updating the component specified by the index value and the given value. The other values in the vector are left intact.
toText
Returns a text representation of the given vector object.
normalized3D
Given a vector that represents either a 3D coordinate or a 3D homogeneous coordinate, the function will return its normalized form. The result will always be a vector of length three, containing the coordinate values for x, y, and z at indices 0, 1, and 2, respectively.
dotProduct
Returns a number representing the dot product of vector1 and vector2. The two vectors must be of the same length. The dot product can be expressed as A · B = |A| |B| cos θ, where |A| and |B| are the magnitudes of vectors A and B, respectively and θ is the angle between the two vectors.
added
Returns a new vector representing the result of adding vector1 and vector2. Vector1 and vector2’s values are not changed.
add
Updates vector1 to be the sum of vector1 and vector2. vector2 is left intact.
subtracted
Returns a new vector representing the result of subtracting vector2 from vector1. Vector1 and vector2’s values are not changed.
subtract
Updates vector1 to be vector1 subtracting vector2. vector2’s value doesn’t change.
multiplied
Returns a new vector containing the elements of a given vector scaled by the given scale value.
multiply
Updates a given vector, with each value scaled by the given scale.
new VectorF
Creates a new vector of the given length. Each value is default to float 0.