vec3 class by value built-in
Three-dimensional vector with floating-point components
Constructors
Functions
- void normalize()
- Scales the vector in place to a length of 1
- vec3 normalized() const
- Returns a copy of the vector scaled to a length of 1
Operators
- vec3 opAdd(const vec3&in) const +
- Adds two vectors
- vec3& opAddAssign(const vec3&in) +=
- Adds another vector in place
- vec3& opAssign(const vec3&in) =
- Copies another vector
- vec3 opDiv(float) const /
- Divides every component by a number
- vec3 opDiv(const vec3&in) const /
- Divides the vectors component by component
- vec3& opDivAssign(float) /=
- Divides every component by a number in place
- vec3& opDivAssign(const vec3&in) /=
- Divides by another vector component by component in place
- bool opEquals(const vec3&in) const ==
- Returns whether all components are exactly equal
- vec3 opMul(float) const *
- Multiplies every component by a number
- vec3 opMul(const vec3&in) const *
- Multiplies the vectors component by component
- vec3& opMulAssign(float) *=
- Multiplies every component by a number in place
- vec3& opMulAssign(const vec3&in) *=
- Multiplies by another vector component by component in place
- vec3 opNeg() const -x
- Returns the vector with all components negated
- vec3 opSub(const vec3&in) const -
- Subtracts two vectors
- vec3& opSubAssign(const vec3&in) -=
- Subtracts another vector in place
Properties
Function documentation
vec3 vec3:: normalized() const
Returns a copy of the vector scaled to a length of 1
A zero-length vector gives NaN in all components.
Operator documentation
Property documentation
float vec3:: lengthSquared read-only
Squared length of the vector
Cheaper than the length, useful for comparing distances.