Struct Vector
2-4-dimensional vector
struct Vector(T, int N)
if (2 <= N && (N <= 4));
Constructors
Name | Description |
---|---|
this
(v)
|
Create with all components filled with specified value |
this
(values)
|
|
this
(v)
|
|
this
(v)
|
|
this
(v)
|
Fields
Type | Name | Description |
---|---|---|
T[N] |
vec
|
|
T |
w
|
|
T |
x
|
|
T |
y
|
|
T |
z
|
Methods
Name | Description |
---|---|
clear
(v)
|
Fill all components of vector with specified value |
magnitude
()
|
Length of vector |
magnitudeSquared
()
|
Sum of squares of all vector components |
normalize
()
|
Normalize vector: make its length == 1 |
normalized
()
|
Returns normalized copy of this vector |
opAssign
(v)
|
|
opAssign
(v)
|
|
opBinary
(v)
|
Perform operation with value to all components of vector |
opBinary
(v)
|
Perform operation with another vector by component |
opBinary
(v)
|
Dot product (sum of by-component products of vector components) |
opCmp
(b)
|
|
opOpAssign
(v)
|
Perform operation with value to all components of vector |
opOpAssign
(v)
|
Perform operation with another vector by component |
opUnary
()
|
Returns vector with all components which are negative of components for this vector |
ptr
()
|
Returns a pointer to the first vector element |
rotated90fromXtoY
()
|
Returns 2D vector rotated 90 degrees CW if left-handed, CCW if right-handed |
rotated90fromYtoX
()
|
Returns 2D vector rotated 90 degrees CCW if left-handed, CW if right-handed |
toString
()
|
Aliases
Name | Description |
---|---|
length
|
Length of vector |
u
|
|
v
|