Struct vec3
3 dimensional vector
struct vec3;
Constructors
| Name | Description |
|---|---|
this
(v)
|
create with all components filled with specified value |
this
(v)
|
|
this
(v)
|
|
this
(v)
|
|
this
(x, y, z)
|
Fields
| Name | Type | Description |
|---|---|---|
vec
|
float[3] | |
x
|
float | |
y
|
float | |
z
|
float |
Properties
| Name | Type | Description |
|---|---|---|
magnitude[get]
|
float | length of vector |
magnitudeSquared[get]
|
float | sum of squares of all vector components |
normalized[get]
|
vec3 | returns normalized copy of this vector |
toString[get]
|
string |
Methods
| Name | Description |
|---|---|
add
(v)
|
add value to all components of vector |
add
(v)
|
add components of another vector to corresponding components of this vector |
clear
(v)
|
fill all components of vector with specified value |
crossProduct
(v1, v2)
|
cross product |
div
(v)
|
divide all components of vector by value |
div
(v)
|
divide components of this vector by corresponding components of another vector |
dot
(v)
|
dot product (sum of by-component products of vector components) |
mul
(v)
|
multiply all components of vector by value |
mul
(v)
|
multiply components of this vector by corresponding components of another vector |
normalize
()
|
normalize vector: make its length == 1 |
opAssign
(v)
|
|
opAssign
(v)
|
|
opAssign
(x, y, z)
|
|
opBinary
(v)
|
add value to all components of vector |
opBinary
(v)
|
multiply all components of vector by value |
opBinary
(v)
|
subtract value from all components of vector |
opBinary
(v)
|
divide all components of vector by value |
opBinary
(v)
|
add value to all components of vector |
opBinary
(v)
|
subtract value from all components of vector |
opBinary
(matrix)
|
multiply vector by matrix |
opOpAssign
(v)
|
add value to all components of vector |
opOpAssign
(v)
|
multiply all components of vector by value |
opOpAssign
(v)
|
subtract value from all components of vector |
opOpAssign
(v)
|
divide all components of vector by value |
opOpAssign
(v)
|
by component add values of corresponding components of other vector |
opOpAssign
(v)
|
by component multiply values of corresponding components of other vector |
opOpAssign
(v)
|
by component subtract values of corresponding components of other vector |
opOpAssign
(v)
|
by component divide values of corresponding components of other vector |
opUnary
()
|
returns vector with all components which are negative of components for this vector |
sub
(v)
|
subtract value from all components of vector |
sub
(v)
|
subtract components of another vector from corresponding components of this vector |
Aliases
| Name | Description |
|---|---|
b
|
|
g
|
|
length
|
|
r
|