Module vec3

Source
Expand description

3 Dimensional Vector

Functions§

add
Adds two vec3’s.
angle
Get the angle between two 3D vectors.
bezier
Performs a bezier interpolation with two control points.
ceil
f32::ceil the components of a vec3.
clone
Creates a new vec3 initialized with values from an existing vector.
copy
Copy the values from one vec3 to another.
create
Creates a new, empty vec3.
cross
Computes the cross product of two vec3’s.
dist
Alias for vec3::distance
distance
Calculates the euclidian distance between two vec3’s.
div
Alias for vec3::divide
divide
Divides two vec3’s.
dot
Calculates the dot product of two vec3’s.
equals
Returns whether or not the vectors have approximately the same elements in the same position.
exact_equals
Returns whether or not the vectors have exactly the same elements in the same position (when compared with ==)
floor
f32::ceil the components of a vec3.
from_values
Creates a new vec3 initialized with the given values.
hermite
Performs a hermite interpolation with two control points.
inverse
Returns the inverse of the components of a vec3.
len
Alias for vec3::length
length
Calculates the length of a vec3.
lerp
Performs a linear interpolation between two vec3’s.
max
Returns the maximum of two vec3’s.
min
Returns the minimum of two vec3’s.
mul
Alias for vec3::multiply
multiply
Multiplies two vec3’s.
negate
Negates the components of a vec3.
normalize
Normalize a vec3.
random
Generates a random vector with the given scale.
rotate_x
Rotate a 3D vector around the x-axis.
rotate_y
Rotate a 3D vector around the y-axis.
rotate_z
Rotate a 3D vector around the z-axis.
round
f32::round the components of a vec3
scale
Scales a vec3 by a scalar number.
scale_and_add
Adds two vec3’s after scaling the second operand by a scalar value.
set
Set the components of a vec3 to the given values.
sqr_dist
Alias for vec3::squared_distance
sqr_len
Alias for vec3::squared_length
squared_distance
Calculates the squared euclidian distance between two vec3’s.
squared_length
Calculates the squared length of a vec3.
sub
Alias for vec3::subtract
subtract
Subtracts vector b from vector a.
transform_mat3
Transforms the vec3 with a mat3.
transform_mat4
Transforms the vec3 with a mat4. 4th vector component is implicitly ‘1’.
transform_quat
Transforms the vec3 with a quat. Can also be used for dual quaternions. (Multiply it with the real part)
vec3_string
Returns a string representation of a vector.
zero
Set the components of a vec3 to zero.