# [−][src]Crate nalgebra_glm

# nalgebra-glm − nalgebra in *easy mode*

**nalgebra-glm** is a GLM-like interface for the **nalgebra** general-purpose linear algebra library.
GLM itself is a popular C++ linear algebra library essentially targeting computer graphics. Therefore
**nalgebra-glm** draws inspiration from GLM to define a nice and easy-to-use API for simple graphics application.

All the types of **nalgebra-glm** are aliases of types from **nalgebra**. Therefore there is a complete and
seamless inter-operability between both.

## Getting started

First of all, you should start by taking a look at the official GLM API documentation
since **nalgebra-glm** implements a large subset of it. To use **nalgebra-glm** to your project, you
should add it as a dependency to your `Crates.toml`

:

```
[dependencies]
nalgebra-glm = "0.1"
```

Then, you should add an `extern crate`

statement to your `lib.rs`

or `main.rs`

file. It is **strongly
recommended** to add a crate alias to `glm`

as well so that you will be able to call functions of
**nalgebra-glm** using the module prefix `glm::`

. For example you will write `glm::rotate(...)`

instead
of the more verbose `nalgebra_glm::rotate(...)`

:

extern crate nalgebra_glm as glm;

## Features overview

**nalgebra-glm** supports most linear-algebra related features of the C++ GLM library. Mathematically
speaking, it supports all the common transformations like rotations, translations, scaling, shearing,
and projections but operating in homogeneous coordinates. This means all the 2D transformations are
expressed as 3x3 matrices, and all the 3D transformations as 4x4 matrices. This is less computationally-efficient
and memory-efficient than nalgebra's transformation types,
but this has the benefit of being simpler to use.

### Main differences compared to GLM

While **nalgebra-glm** follows the feature line of the C++ GLM library, quite a few differences
remain and they are mostly syntactic. The main ones are:

- All function names use
`snake_case`

, which is the Rust convention. - All type names use
`CamelCase`

, which is the Rust convention. - All function arguments, except for scalars, are all passed by-reference.
- The most generic vector and matrix types are
`TMat`

and`TVec`

instead of`mat`

and`vec`

. - Some feature are not yet implemented and should be added in the future. In particular, no packing functions are available.
- A few features are not implemented and will never be. This includes functions related to color spaces, and closest points computations. Other crates should be used for those. For example, closest points computation can be handled by the ncollide project.

In addition, because Rust does not allows function overloading, all functions must be given a unique name.
Here are a few rules chosen arbitrarily for **nalgebra-glm**:

- Functions operating in 2d will usually end with the
`2d`

suffix, e.g.,`glm::rotate2d`

is for 2D while`glm::rotate`

is for 3D. - Functions operating on vectors will often end with the
`_vec`

suffix, possibly followed by the dimension of vector, e.g.,`glm::rotate_vec2`

. - Every function related to quaternions start with the
`quat_`

prefix, e.g.,`glm::quat_dot(q1, q2)`

. - All the conversion functions have unique names as described below.

### Vector and matrix construction

Vectors, matrices, and quaternions can be constructed using several approaches:

- Using functions with the same name as their type in lower-case. For example
`glm::vec3(x, y, z)`

will create a 3D vector. - Using the
`::new`

constructor. For example`Vec3::new(x, y, z)`

will create a 3D vector. - Using the functions prefixed by
`make_`

to build a vector a matrix from a slice. For example`glm::make_vec3(&[x, y, z])`

will create a 3D vector. Keep in mind that constructing a matrix using this type of functions require its components to be arranged in column-major order on the slice. - Using a geometric construction function. For example
`glm::rotation(angle, axis)`

will build a 4x4 homogeneous rotation matrix from an angle (in radians) and an axis. - Using swizzling and conversions as described in the next sections.

### Swizzling

Vector swizzling is a native feature of **nalgebra** itself. Therefore, you can use it with all
the vectors of **nalgebra-glm** as well. Swizzling is supported as methods and works only up to
dimension 3, i.e., you can only refer to the components `x`

, `y`

and `z`

and can only create a
2D or 3D vector using this technique. Here is some examples, assuming `v`

is a vector with float
components here:

`v.xx()`

is equivalent to`glm::vec2(v.x, v.x)`

and to`Vec2::new(v.x, v.x)`

.`v.zx()`

is equivalent to`glm::vec2(v.z, v.x)`

and to`Vec2::new(v.z, v.x)`

.`v.yxz()`

is equivalent to`glm::vec3(v.y, v.x, v.z)`

and to`Vec3::new(v.y, v.x, v.z)`

.`v.zzy()`

is equivalent to`glm::vec3(v.z, v.z, v.y)`

and to`Vec3::new(v.z, v.z, v.y)`

.

Any combination of two or three components picked among `x`

, `y`

, and `z`

will work.

### Conversions

It is often useful to convert one algebraic type to another. There are two main approaches for converting
between types in `nalgebra-glm`

:

- Using function with the form
`type1_to_type2`

in order to convert an instance of`type1`

into an instance of`type2`

. For example`glm::mat3_to_mat4(m)`

will convert the 3x3 matrix`m`

to a 4x4 matrix by appending one column on the right and one row on the left. Those now row and columns are filled with 0 except for the diagonal element which is set to 1. - Using one of the
`convert`

,`try_convert`

, or`convert_unchecked`

functions. These functions are directly re-exported from nalgebra and are extremely versatile:- The
`convert`

function can convert any type (especially geometric types from nalgebra like`Isometry3`

) into another algebraic type which is equivalent but more general. For example,`let sim: Similarity3<_> = na::convert(isometry)`

will convert an`Isometry3`

into a`Similarity3`

. In addition,`let mat: Mat4 = glm::convert(isometry)`

will convert an`Isometry3`

to a 4x4 matrix. This will also convert the scalar types, therefore:`let mat: DMat4 = glm::convert(m)`

where`m: Mat4`

will work. However, conversion will not work the other way round: you can't convert a`Matrix4`

to an`Isometry3`

using`glm::convert`

because that could cause unexpected results if the matrix does not complies to the requirements of the isometry. - If you need this kind of conversions anyway, you can use
`try_convert`

which will test if the object being converted complies with the algebraic requirements of the target type. This will return`None`

if the requirements are not satisfied. - The
`convert_unchecked`

will ignore those tests and always perform the conversion, even if that breaks the invariants of the target type. This must be used with care! This is actually the recommended method to convert between homogeneous transformations generated by`nalgebra-glm`

and specific transformation types from**nalgebra**like`Isometry3`

. Just be careful you know your conversions make sense.

- The

### Should I use nalgebra or nalgebra-glm?

Well that depends on your tastes and your background. **nalgebra** is more powerful overall since it allows stronger typing,
and goes much further than simple computer graphics math. However, has a bit of a learning curve for
those not used to the abstract mathematical concepts for transformations. **nalgebra-glm** however
have more straightforward functions and benefit from the various tutorials existing on the internet
for the original C++ GLM library.

Overall, if you are already used to the C++ GLM library, or to working with homogeneous coordinates (like 4D
matrices for 3D transformations), then you will have more success with **nalgebra-glm**. If on the other
hand you prefer more rigorous treatments of transformations, with type-level restrictions, then go for **nalgebra**.
If you need dynamically-sized matrices, you should go for **nalgebra** as well.

Keep in mind that **nalgebra-glm** is just a different API for **nalgebra**. So you can very well use both
and benefit from both their advantages: use **nalgebra-glm** when mathematical rigor is not that important,
and **nalgebra** itself when you need more expressive types, and more powerful linear algebra operations like
matrix factorizations and slicing. Just remember that all the **nalgebra-glm** types are just aliases to **nalgebra** types,
and keep in mind it is possible to convert, e.g., an `Isometry3`

to a `Mat4`

and vice-versa (see the conversions section).

## Structs

DefaultAllocator |
An allocator based on |

U1 |
A type level dimension with a value of |

U2 |
A type level dimension. |

U3 |
A type level dimension. |

U4 |
A type level dimension. |

## Traits

Dimension |
A type-level number representing a vector, matrix row, or matrix column, dimension. |

Number |
A number that can either be an integer or a float. |

Real |
Trait shared by all reals. |

Scalar |
The basic scalar type for all structures of |

## Functions

abs |
For each matrix or vector component |

acos |
Component-wise arc-cosinus. |

acosh |
Component-wise hyperbolic arc-cosinus. |

affine_inverse |
Fast matrix inverse for affine matrix. |

all |
Checks that all the vector components are |

angle |
The angle between two vectors. |

any |
Checks that at least one of the vector components is |

are_collinear |
Returns |

are_collinear2d |
Returns |

are_orthogonal |
Returns |

asin |
Component-wise arc-sinus. |

asinh |
Component-wise hyperbolic arc-sinus. |

atan |
Component-wise arc-tangent. |

atan2 |
Component-wise arc-tangent of |

atanh |
Component-wise hyperbolic arc-tangent. |

ceil |
For each matrix or vector component returns a value equal to the nearest integer that is greater than or equal to |

clamp |
Returns |

clamp_scalar |
Returns |

clamp_vec |
Returns |

column |
The |

comp_add |
The sum of every component of the given matrix or vector. |

comp_max |
The maximum of every component of the given matrix or vector. |

comp_min |
The minimum of every component of the given matrix or vector. |

comp_mul |
The product of every component of the given matrix or vector. |

convert |
Converts an object from one type to an equivalent or more general one. |

convert_ref |
Converts an object from one type to an equivalent or more general one. |

convert_ref_unchecked^{⚠} |
Use with care! Same as |

convert_unchecked^{⚠} |
Use with care! Same as |

cos |
Component-wise cosinus. |

cosh |
Component-wise hyperbolic cosinus. |

cross |
The cross product of two vectors. |

cross2d |
The 2D perpendicular product between two vectors. |

degrees |
Component-wise conversion from radians to degrees. |

determinant |
The determinant of the matrix |

diagonal2x2 |
Builds a 2x2 diagonal matrix. |

diagonal2x3 |
Builds a 2x3 diagonal matrix. |

diagonal2x4 |
Builds a 2x4 diagonal matrix. |

diagonal3x2 |
Builds a 3x2 diagonal matrix. |

diagonal3x3 |
Builds a 3x3 diagonal matrix. |

diagonal3x4 |
Builds a 3x4 diagonal matrix. |

diagonal4x2 |
Builds a 4x2 diagonal matrix. |

diagonal4x3 |
Builds a 4x3 diagonal matrix. |

diagonal4x4 |
Builds a 4x4 diagonal matrix. |

distance |
The distance between two points. |

distance2 |
The squared distance between two points. |

dot |
The dot product of two vectors. |

e |
The Euler constant. |

epsilon |
Default epsilon value used for approximate comparison. |

equal |
Component-wise equality comparison. |

equal_columns |
Perform a component-wise equal-to comparison of two matrices. |

equal_columns_eps |
Returns the component-wise comparison of |

equal_columns_eps_vec |
Returns the component-wise comparison on each matrix column |

equal_eps |
Component-wise approximate equality of two vectors, using a scalar epsilon. |

equal_eps_vec |
Component-wise approximate equality of two vectors, using a per-component epsilon. |

euler |
The Euler constant. |

exp |
Component-wise exponential. |

exp2 |
Component-wise base-2 exponential. |

faceforward |
If |

fast_normalize_dot |
The dot product of the normalized version of |

float_bits_to_int |
Returns a signed integer value representing the encoding of a floating-point value. |

float_bits_to_int_vec |
Returns a signed integer value representing the encoding of each component of |

float_bits_to_uint |
Returns an unsigned integer value representing the encoding of a floating-point value. |

float_bits_to_uint_vec |
Returns an unsigned integer value representing the encoding of each component of |

floor |
Returns componentwise a value equal to the nearest integer that is less then or equal to |

four_over_pi |
Returns |

fract |
Returns the fractional part of each component of |

golden_ratio |
Returns the golden ratio. |

greater_than |
Component-wise |

greater_than_equal |
Component-wise |

half_pi |
Returns |

identity |
The identity matrix. |

int_bits_to_float |
Returns a floating-point value corresponding to a signed integer encoding of a floating-point value. |

int_bits_to_float_vec |
For each components of |

inverse |
The inverse of the matrix |

inverse_transpose |
Compute the transpose of the inverse of a matrix. |

inversesqrt |
Compute the inverse of the square root of each component of |

is_comp_null |
Returns |

is_normalized |
Returns |

is_null |
Returns |

l1_distance |
The l1-norm of |

l1_norm |
The l1-norm of |

l2_distance |
The l2-norm of |

l2_norm |
The l2-norm of |

left_handed |
Returns |

length |
The magnitude of a vector. |

length2 |
The squared magnitude of |

lerp |
Returns |

lerp_scalar |
Returns |

lerp_vec |
Returns |

less_than |
Component-wise |

less_than_equal |
Component-wise |

ln_ln_two |
Returns |

ln_ten |
Returns |

ln_two |
Returns |

log |
Component-wise logarithm. |

log2 |
Component-wise base-2 logarithm. |

look_at |
Build a look at view matrix based on the right handedness. |

look_at_lh |
Build a left handed look at view matrix. |

look_at_rh |
Build a right handed look at view matrix. |

magnitude |
The magnitude of a vector. |

magnitude2 |
The squared magnitude of |

make_mat2 |
Creates a 2x2 matrix from a slice arranged in column-major order. |

make_mat3 |
Creates a 3 matrix from a slice arranged in column-major order. |

make_mat4 |
Creates a 4x4 matrix from a slice arranged in column-major order. |

make_mat2x2 |
Creates a 2x2 matrix from a slice arranged in column-major order. |

make_mat2x3 |
Creates a 2x3 matrix from a slice arranged in column-major order. |

make_mat2x4 |
Creates a 2x4 matrix from a slice arranged in column-major order. |

make_mat3x2 |
Creates a 3x2 matrix from a slice arranged in column-major order. |

make_mat3x3 |
Creates a 3x3 matrix from a slice arranged in column-major order. |

make_mat3x4 |
Creates a 3x4 matrix from a slice arranged in column-major order. |

make_mat4x2 |
Creates a 4x2 matrix from a slice arranged in column-major order. |

make_mat4x3 |
Creates a 4x3 matrix from a slice arranged in column-major order. |

make_mat4x4 |
Creates a 4x4 matrix from a slice arranged in column-major order. |

make_quat |
Creates a quaternion from a slice arranged as |

make_vec1 |
Creates a 1D vector from a slice. |

make_vec2 |
Creates a 2D vector from a slice. |

make_vec3 |
Creates a 3D vector from another vector. |

make_vec4 |
Creates a 4D vector from another vector. |

mat2 |
Create a new 2x2 matrix. |

mat3 |
Create a new 3x3 matrix. |

mat3_to_quat |
Converts a rotation matrix to a quaternion. |

mat4 |
Create a new 4x4 matrix. |

mat2_to_mat3 |
Converts a 2x2 matrix to a 3x3 matrix. |

mat2_to_mat4 |
Converts a 2x2 matrix to a 4x4 matrix. |

mat2x2 |
Create a new 2x2 matrix. |

mat2x3 |
Create a new 2x3 matrix. |

mat2x4 |
Create a new 2x4 matrix. |

mat3_to_mat2 |
Converts a 3x3 matrix to a 2x2 matrix. |

mat3_to_mat4 |
Converts a 3x3 matrix to a 4x4 matrix. |

mat3x2 |
Create a new 3x2 matrix. |

mat3x3 |
Create a new 3x3 matrix. |

mat3x4 |
Create a new 3x4 matrix. |

mat4_to_mat2 |
Converts a 4x4 matrix to a 2x2 matrix. |

mat4_to_mat3 |
Converts a 4x4 matrix to a 3x3 matrix. |

mat4x2 |
Create a new 4x2 matrix. |

mat4x3 |
Create a new 4x3 matrix. |

mat4x4 |
Create a new 4x4 matrix. |

matrix_comp_mult |
Component-wise multiplication of two matrices. |

matrix_cross |
Builds a 4x4 matrix |

matrix_cross3 |
Builds a 3x3 matrix |

max |
Component-wise maximum between a vector and a scalar. |

max2 |
Component-wise maximum between two vectors. |

max3 |
Component-wise maximum between three vectors. |

max3_scalar |
Returns the maximum among three values. |

max4 |
Component-wise maximum between four vectors. |

max4_scalar |
Returns the maximum among four values. |

min |
Component-wise minimum between a vector and a scalar. |

min2 |
Component-wise minimum between two vectors. |

min3 |
Component-wise minimum between three vectors. |

min3_scalar |
Returns the minimum among three values. |

min4 |
Component-wise minimum between four vectors. |

min4_scalar |
Returns the minimum among four values. |

mix |
Returns |

mix_scalar |
Returns |

mix_vec |
Returns |

modf |
Modulus between two values. |

modf_vec |
Component-wise modulus. |

normalize |
Normalizes a vector. |

normalize_dot |
The dot product of the normalized version of |

not |
Component-wise not |

not_equal |
Component-wise not-equality |

not_equal_columns |
Perform a component-wise not-equal-to comparison of two matrices. |

not_equal_columns_eps |
Returns the component-wise comparison of |

not_equal_columns_eps_vec |
Returns the component-wise comparison of |

not_equal_eps |
Component-wise approximate non-equality of two vectors, using a scalar epsilon. |

not_equal_eps_vec |
Component-wise approximate non-equality of two vectors, using a per-component epsilon. |

one |
Gets the multiplicative identity element. |

one_over_pi |
Returns |

one_over_root_two |
Returns |

one_over_two_pi |
Returns |

orientation |
Build the rotation matrix needed to align |

ortho |
Creates a matrix for an orthographic parallel viewing volume, using the right handedness and OpenGL near and far clip planes definition. |

outer_product |
Treats the first parameter |

perspective |
Creates a matrix for a perspective-view frustum based on the right handedness and OpenGL near and far clip planes definition. |

pi |
The value of PI. |

pick_matrix |
Define a picking region. |

pow |
Component-wise power. |

proj |
Build planar projection matrix along normal axis, and right-multiply it to |

proj2d |
Build planar projection matrix along normal axis and right-multiply it to |

project |
Map the specified object coordinates |

project_no |
Map the specified object coordinates (obj.x, obj.y, obj.z) into window coordinates. |

project_zo |
Map the specified object coordinates (obj.x, obj.y, obj.z) into window coordinates. |

quarter_pi |
Returns |

quat |
Creates a new quaternion. |

quat_angle |
The rotation angle of this quaternion assumed to be normalized. |

quat_angle_axis |
Creates a quaternion from an axis and an angle. |

quat_axis |
The rotation axis of a quaternion assumed to be normalized. |

quat_cast |
Convert a quaternion to a rotation matrix in homogeneous coordinates. |

quat_conjugate |
The conjugate of |

quat_cross |
Multiplies two quaternions. |

quat_cross_vec |
Rotate the vector |

quat_dot |
The scalar product of two quaternions. |

quat_equal |
Component-wise equality comparison between two quaternions. |

quat_equal_eps |
Component-wise approximate equality comparison between two quaternions. |

quat_euler_angles |
Euler angles of the quaternion |

quat_exp |
Computes the quaternion exponential. |

quat_extract_real_component |
The quaternion |

quat_fast_mix |
Normalized linear interpolation between two quaternions. |

quat_greater_than |
Component-wise |

quat_greater_than_equal |
Component-wise |

quat_identity |
The quaternion representing the identity rotation. |

quat_inv_cross_vec |
Rotate the vector |

quat_inverse |
The inverse of |

quat_length |
The magnitude of the quaternion |

quat_length2 |
The squared magnitude of a quaternion |

quat_lerp |
Interpolate linearly between |

quat_less_than |
Component-wise |

quat_less_than_equal |
Component-wise |

quat_log |
Computes the quaternion logarithm. |

quat_look_at |
Computes a right-handed look-at quaternion (equivalent to a right-handed look-at matrix). |

quat_look_at_lh |
Computes a left-handed look-at quaternion (equivalent to a left-handed look-at matrix). |

quat_look_at_rh |
Computes a right-handed look-at quaternion (equivalent to a right-handed look-at matrix). |

quat_magnitude |
The magnitude of the quaternion |

quat_magnitude2 |
The squared magnitude of a quaternion |

quat_normalize |
Normalizes the quaternion |

quat_not_equal |
Component-wise non-equality comparison between two quaternions. |

quat_not_equal_eps |
Component-wise approximate non-equality comparison between two quaternions. |

quat_pitch |
The "pitch" Euler angle of the quaternion |

quat_pow |
Raises the quaternion |

quat_roll |
The "roll" Euler angle of the quaternion |

quat_rotate |
Builds a quaternion from an axis and an angle, and right-multiply it to the quaternion |

quat_rotate_normalized_axis |
Rotates a quaternion from a vector of 3 components normalized axis and an angle. |

quat_rotate_vec |
Rotates a vector in homogeneous coordinates by a quaternion assumed to be normalized. |

quat_rotate_vec3 |
Rotates a vector by a quaternion assumed to be normalized. |

quat_rotation |
The rotation required to align |

quat_short_mix |
The spherical linear interpolation between two quaternions. |

quat_slerp |
Interpolate spherically between |

quat_to_mat3 |
Converts a quaternion to a rotation matrix. |

quat_to_mat4 |
Converts a quaternion to a rotation matrix in homogenous coordinates. |

quat_yaw |
The "yaw" Euler angle of the quaternion |

radians |
Component-wise conversion fro degrees to radians. |

reflect |
Builds a reflection matrix, and right-multiply it to |

reflect2d |
Builds a reflection matrix and right-multiply it to |

reflect_vec |
For the incident vector |

refract_vec |
For the incident vector |

right_handed |
Returns |

root_five |
Returns |

root_half_pi |
Returns |

root_ln_four |
Returns |

root_pi |
Returns the square root of pi. |

root_three |
Returns the square root of 3. |

root_two |
Returns the square root of 2. |

root_two_pi |
Returns the square root of 2pi. |

rotate |
Builds a rotation 4 * 4 matrix created from an axis vector and an angle and right-multiply it to |

rotate2d |
Builds a 2D rotation matrix from an angle and right-multiply it to |

rotate_normalized_axis |
Builds a rotation 4 * 4 matrix created from a normalized axis and an angle. |

rotate_vec2 |
Rotate a two dimensional vector. |

rotate_vec3 |
Rotate a three dimensional vector around an axis. |

rotate_vec4 |
Rotate a thee dimensional vector in homogeneous coordinates around an axis. |

rotate_x |
Builds a rotation 4 * 4 matrix around the X axis and right-multiply it to |

rotate_x_vec3 |
Rotate a three dimensional vector around the |

rotate_x_vec4 |
Rotate a three dimensional vector in homogeneous coordinates around the |

rotate_y |
Builds a rotation 4 * 4 matrix around the Y axis and right-multiply it to |

rotate_y_vec3 |
Rotate a three dimensional vector around the |

rotate_y_vec4 |
Rotate a three dimensional vector in homogeneous coordinates around the |

rotate_z |
Builds a rotation 4 * 4 matrix around the Z axis and right-multiply it to |

rotate_z_vec3 |
Rotate a three dimensional vector around the |

rotate_z_vec4 |
Rotate a three dimensional vector in homogeneous coordinates around the |

rotation |
A rotation 4 * 4 matrix created from an axis of 3 scalars and an angle expressed in radians. |

rotation2d |
A rotation 3 * 3 matrix created from an angle expressed in radians. |

round |
Component-wise rounding. |

row |
The |

scale |
Builds a scale 4 * 4 matrix created from 3 scalars and right-multiply it to |

scale2d |
Builds a 2D scaling matrix and right-multiply it to |

scale_bias |
Builds a scale-bias matrix, and right-multiply it to |

scale_bias_matrix |
Builds a scale-bias matrix. |

scaling |
A 4 * 4 scale matrix created from a vector of 3 components. |

scaling2d |
A 3 * 3 scale matrix created from a vector of 2 components. |

set_column |
Sets to |

set_row |
Sets to |

shear2d_x |
Transforms a matrix with a shearing on X axis. |

shear2d_y |
Transforms a matrix with a shearing on Y axis. |

shear_x |
Transforms a matrix with a shearing on Y axis. |

shear_y |
Transforms a matrix with a shearing on Y axis. |

shear_z |
Transforms a matrix with a shearing on Z axis. |

sign |
For each vector component |

sin |
Component-wise sinus. |

sinh |
Component-wise hyperbolic sinus. |

slerp |
Computes a spherical linear interpolation between the vectors |

smoothstep |
Returns 0.0 if |

sqrt |
Component-wise square root. |

step |
Returns 0.0 if |

step_scalar |
Returns 0.0 if |

step_vec |
Returns 0.0 if |

tan |
Component-wise tangent. |

tanh |
Component-wise hyperbolic tangent. |

third |
Returns |

three_over_two_pi |
Returns |

to_quat |
Converts a rotation matrix in homogeneous coordinates to a quaternion. |

translate |
Builds a translation 4 * 4 matrix created from a vector of 3 components and right-multiply it to |

translate2d |
Builds a translation matrix and right-multiply it to |

translation |
A 4 * 4 translation matrix created from the scaling factor on each axis. |

translation2d |
A 3 * 3 translation matrix created from the scaling factor on each axis. |

transpose |
The transpose of the matrix |

triangle_normal |
The normal vector of the given triangle. |

trunc |
Returns a value equal to the nearest integer to |

try_convert |
Attempts to convert an object to a more specific one. |

try_convert_ref |
Attempts to convert an object to a more specific one. |

two_over_pi |
Returns |

two_over_root_pi |
Returns |

two_pi |
Returns |

two_thirds |
Returns |

uint_bits_to_float |
For each component of |

uint_bits_to_float_scalar |
Returns a floating-point value corresponding to a unsigned integer encoding of a floating-point value. |

unproject |
Map the specified window coordinates (win.x, win.y, win.z) into object coordinates using OpenGL near and far clip planes definition. |

unproject_no |
Map the specified window coordinates (win.x, win.y, win.z) into object coordinates. |

unproject_zo |
Map the specified window coordinates (win.x, win.y, win.z) into object coordinates. |

value_ptr |
Converts a matrix or vector to a slice arranged in column-major order. |

value_ptr_mut |
Converts a matrix or vector to a mutable slice arranged in column-major order. |

vec1 |
Creates a new 1D vector. |

vec2 |
Creates a new 2D vector. |

vec3 |
Creates a new 3D vector. |

vec4 |
Creates a new 4D vector. |

vec1_to_vec2 |
Creates a 2D vector from another vector. |

vec1_to_vec3 |
Creates a 3D vector from another vector. |

vec1_to_vec4 |
Creates a 4D vector from another vector. |

vec2_to_vec1 |
Creates a 1D vector from another vector. |

vec2_to_vec2 |
Creates a 2D vector from another vector. |

vec2_to_vec3 |
Creates a 3D vector from another vector. |

vec2_to_vec4 |
Creates a 4D vector from another vector. |

vec3_to_vec1 |
Creates a 1D vector from another vector. |

vec3_to_vec2 |
Creates a 2D vector from another vector. |

vec3_to_vec3 |
Creates a 3D vector from another vector. |

vec3_to_vec4 |
Creates a 4D vector from another vector. |

vec4_to_vec1 |
Creates a 1D vector from another vector. |

vec4_to_vec2 |
Creates a 2D vector from another vector. |

vec4_to_vec3 |
Creates a 3D vector from another vector. |

vec4_to_vec4 |
Creates a 4D vector from another vector. |

zero |
Gets the additive identity element. |

## Type Definitions

BVec1 |
A 1D vector with boolean components. |

BVec2 |
A 2D vector with boolean components. |

BVec3 |
A 3D vector with boolean components. |

BVec4 |
A 4D vector with boolean components. |

DMat2 |
A 2x2 matrix with components of type |

DMat3 |
A 3x3 matrix with |

DMat4 |
A 4x4 matrix with |

DMat2x2 |
A 2x2 matrix with |

DMat2x3 |
A 2x3 matrix with |

DMat2x4 |
A 2x4 matrix with |

DMat3x2 |
A 3x2 matrix with |

DMat3x3 |
A 3x3 matrix with |

DMat3x4 |
A 3x4 matrix with |

DMat4x2 |
A 4x2 matrix with |

DMat4x3 |
A 4x3 matrix with |

DMat4x4 |
A 4x4 matrix with |

DQuat |
A quaternion with f64 components. |

DVec1 |
A 1D vector with |

DVec2 |
A 2D vector with |

DVec3 |
A 3D vector with |

DVec4 |
A 4D vector with |

I16Vec1 |
A 1D vector with |

I16Vec2 |
A 2D vector with |

I16Vec3 |
A 3D vector with |

I16Vec4 |
A 4D vector with |

I32Vec1 |
A 1D vector with |

I32Vec2 |
A 2D vector with |

I32Vec3 |
A 3D vector with |

I32Vec4 |
A 4D vector with |

I64Vec1 |
A 1D vector with |

I64Vec2 |
A 2D vector with |

I64Vec3 |
A 3D vector with |

I64Vec4 |
A 4D vector with |

I8Vec1 |
A 1D vector with |

I8Vec2 |
A 2D vector with |

I8Vec3 |
A 3D vector with |

I8Vec4 |
A 4D vector with |

IVec1 |
A 1D vector with |

IVec2 |
A 2D vector with |

IVec3 |
A 3D vector with |

IVec4 |
A 4D vector with |

Mat2 |
A 2x2 matrix with |

Mat3 |
A 3x3 matrix with |

Mat4 |
A 4x4 matrix with |

Mat2x2 |
A 2x2 matrix with |

Mat2x3 |
A 2x2 matrix with |

Mat2x4 |
A 2x4 matrix with |

Mat3x2 |
A 3x2 matrix with |

Mat3x3 |
A 3x3 matrix with |

Mat3x4 |
A 3x4 matrix with |

Mat4x2 |
A 4x2 matrix with |

Mat4x3 |
A 4x3 matrix with |

Mat4x4 |
A 4x4 matrix with |

Qua |
A quaternion with components of type |

Quat |
A quaternion with f32 components. |

TMat |
A matrix with components of type |

TMat2 |
A 2x2 matrix with components of type |

TMat3 |
A 3x3 matrix with components of type |

TMat4 |
A 4x4 matrix with components of type |

TMat2x2 |
A 2x2 matrix with components of type |

TMat2x3 |
A 2x3 matrix with components of type |

TMat2x4 |
A 2x4 matrix with components of type |

TMat3x2 |
A 3x2 matrix with components of type |

TMat3x3 |
A 3x3 matrix with components of type |

TMat3x4 |
A 3x4 matrix with components of type |

TMat4x2 |
A 4x2 matrix with components of type |

TMat4x3 |
A 4x3 matrix with components of type |

TMat4x4 |
A 4x4 matrix with components of type |

TVec |
A column vector with components of type |

TVec1 |
A 1D vector with components of type |

TVec2 |
A 2D vector with components of type |

TVec3 |
A 3D vector with components of type |

TVec4 |
A 4D vector with components of type |

U16Vec1 |
A 1D vector with |

U16Vec2 |
A 2D vector with |

U16Vec3 |
A 3D vector with |

U16Vec4 |
A 4D vector with |

U32Vec1 |
A 1D vector with |

U32Vec2 |
A 2D vector with |

U32Vec3 |
A 3D vector with |

U32Vec4 |
A 4D vector with |

U64Vec1 |
A 1D vector with |

U64Vec2 |
A 2D vector with |

U64Vec3 |
A 3D vector with |

U64Vec4 |
A 4D vector with |

U8Vec1 |
A 1D vector with |

U8Vec2 |
A 2D vector with |

U8Vec3 |
A 3D vector with |

U8Vec4 |
A 4D vector with |

UVec1 |
A 1D vector with |

UVec2 |
A 2D vector with |

UVec3 |
A 3D vector with |

UVec4 |
A 4D vector with |

Vec1 |
A 1D vector with |

Vec2 |
A 2D vector with |

Vec3 |
A 3D vector with |

Vec4 |
A 4D vector with |