Crate lina[−][src]
Expand description
Yet another linear algebra library with a focus on computer graphics.
This library heavily uses const generics for vectors, points and matrices,
but still allows scalar access via .x
, .y
, .z
and .w
for small
vectors and points. While these three types are generic over their
dimension, some features are only implemented for small dimensions.
- Vectors and points with generic dimension (see
this explanation on why
lina
has two vector-like types) - Matrices with generic dimensions
- Strongly typed angles:
Degrees
andRadians
- Commonly used transformations
- Spherical coordinates:
SphericalPos
andNormedSphericalPos
- Several helper functions:
atan2
,clamp
,lerp
,slerp
, … - Auxiliary documentation about topics like computer graphics, linear algebra, …
Note: currently lina
requires a nightly compiler.
Modules
Auxiliary documentation about linear algebra and computer graphics.
Helper types and traits to access specific coordinates of vectors of points
by name (x
, y
, z
and w
).
Transformation matrices for common transformations.
Structs
An angle in degrees. A full rotation is 360°.
A C
×R
matrix with element type T
(C
many columns, R
many rows).
Column-major memory layout.
A point on the boundary of a unit sphere described in spherical coordinates (without radius).
A point in N
-dimensional space with scalar type T
. It represents
a location in space.
An angle in radians. A full rotation is 2π rad.
A 3D point described in spherical coordinates (theta θ, phi φ, radius r).
An N
-dimensional vector with scalar type T
. This represents
a displacement in space.
Traits
Functions
Returns the angle between the two given vectors. Returns garbage if either vector has length 0.
The atan2
function.
Clamps val
into the range min..=max
.
Returns the cross product a ⨯ b
, a vector perpendicular to both
input vectors.
Returns the dot product a · b
, a scalar value.
Linearly interpolates between a
and b
with the given factor
.
factor = 0
is 100% a
, factor = 1
is 100% b
.
Shorthand for Point2::new(...)
.
Shorthand for Point3::new(...)
.
Spherical linear interpolation between a
and b
with the given factor
.
factor = 0
is 100% a
, factor = 1
is 100% b
.
Shorthand for Vec2::new(...)
.
Shorthand for Vec3::new(...)
.
Shorthand for Vec4::new(...)
.
Type Definitions
A 2×2 matrix.
A 2×2 matrix with f62
elements.
A 2×2 matrix with f32
elements.
A 3×3 matrix.
A 3×3 matrix with f63
elements.
A 3×3 matrix with f32
elements.
A 4×4 matrix.
A 4×4 matrix with f64
elements.
A 4×4 matrix with f32
elements.
A point in 2-dimensional space.
A point in 2-dimensional space with scalar type f64
.
A point in 2-dimensional space with scalar type f32
.
A point in 3-dimensional space.
A point in 3-dimensional space with scalar type f64
.
A point in 3-dimensional space with scalar type f32
.
A 2-dimensional vector.
A 2-dimensional vector with scalar type f64
.
A 2-dimensional vector with scalar type f32
.
A 3-dimensional vector.
A 3-dimensional vector with scalar type f64
.
A 3-dimensional vector with scalar type f32
.
A 4-dimensional vector.
A 4-dimensional vector with scalar type f64
.
A 4-dimensional vector with scalar type f32
.