Constructs a vector from an array of elements.
Constructs a vector from a variadic list of elements.
Constructs a vector where all elements have the given value.
Constructs a vector as a copy of the other.
Adds the given vector to this one.
Adds the given scalar value to this vector.
Gets a copy of this vector.
Computes the cross product of this vector and another, and stores the result in this vector.
Divides this vector by a factor, element-wise.
Divides this vector by another vector, element-wise.
Determines the dot product of this vector and another vector.
Determines the magnitude of this vector.
Determines the squared magnitude of this vector.
Multiplies this vector by a factor, element-wise.
Multiplies this vector by another vector, element-wise.
Normalizes this vector, such that it will have a magnitude of 1.
Implements the basic binary operators between two vectors. It supports element-wise addition, subtraction, multiplication, and division.
Implements the basic binary operators between a vector and a scalar value. It supports element-wise addition, subtraction multiplication, and division.
Right-hand binary operator implementation. See opBinary above for more info.
Implements explicit casting between vector types. You may cast to a type with a different T element type, or a different size, or both. Casting to a different element type will call a normal cast(newType) oldValue for each value. When casting to a smaller vector size, extra elements will be truncated, and when casting to a larger size, missing elements are initialized to zero.
Compares this vector to another, based on their magnitudes.
Named accessor for common vector fields, which allows you to get the value of specific elements in the vector according to conventional names. - x for the first element. - y for the second element. - z for the third element. - w for the fourth element.
Named setter for common vector fields, which allows you to set the value of specific elements in the vector according to conventional names. - x for the first element. - y for the second element. - z for the third element. - w for the fourth element.
Determines if two vectors are equal. Vectors are considered equal when all of their components are equal.
Gets the element at a specified index.
Inserts an element at the specified index.
Implements op-assignments for indexed values of the vector, so you can do things like v[2] *= 10;. Supports addition, subtraction, multiplication, and division.
Implements the basic unary operators on a vector. This supports: - Negation -v: Negates all a vector's components. - Incrementation ++v: Increments all a vector's components by 1. - Decrementation --v: Decrements all a vector's components by 1.
Sets all elements of the vector to those in the specified array.
Sets all the elements of the vector to those in the specified variadic array. Note that if the given list of elements is shorter than the vector's size, only the first elements.length elements will be set, and if the list of elements is larger than the vector's size, any extra elements will be ignored.
Subtracts the given vector from this one.
Subtracts the given scalar value from this vector.
Converts this 2-dimensional vector from Cartesian to Polar coordinates. It is assumed that the first element is the **x** coordinate, and the second element is the **y** coordinate. The first element becomes the **radius** and the second becomes the angle **theta**. - The angle is normalized to be within the range [0, 2*PI).
Gets a simple string representation of this vector.
Constructs a vector containing all 0's.
Computes the sum of a given array of vectors.
A static contstant that can be used to get the size of the vector.
The internal static array storing the elements of this vector.
Generic struct that represents a vector holding size elements of type T. A vector must contain at least 1 element, and has no upper-bound on the size beyond restrictions imposed by the system.