Crate math_utils

Crate math_utils 

Source
Expand description

Math types and traits

§Vectors & points

§Matrices & rotations

Matrices are column-major for SIMD efficiency.

§Affine transformations

Re-exports§

pub use vek::approx;
pub use vek::num_traits;
pub use vek;

Modules§

algebra
Elementary and linear algebraic methods
coordinate
Tagged coordinate types
data
Data analysis routines
geometry
Geometry utilities

Macros§

matrix
vector

Structs§

AffineMap
Homomorphism of affine spaces: a combination of a linear map and a translation
Affinity
Affine isomorphism
AngleWrapped
Unsigned wrapped angle restricted to $[0, 2\pi)$
AngleWrappedSigned
Signed wrapped angle restricted to $(-\pi, \pi]$
Angles3
(Euler angles) representation of a 3D orientation. Internally the angles are wrapped to $[0, 2\pi)$.
Deg
Degrees
LinearAuto
Invertible linear endomorphism
LinearIso
Invertible linear map
Matrix2
2x2 matrix.
Matrix3
3x3 matrix.
Matrix4
4x4 matrix.
NonNegative
Non-negative scalars (may be zero)
NonZero
Non-zero scalars
NonZero2
2D non-zero vector
NonZero3
3D non-zero vector
NonZero4
4D non-zero vector
NormalSigned
Scalars in the closed interval [-1, 1]
Normalized
Scalars in the closed unit interval [0, 1]
Point2
2D position
Point3
3D position
Point4
4D position
Pose3
Representation of a 3D position + orientation
Positive
Strictly positive scalars (non-zero)
Projectivity
Isomorphism of projective spaces (a.k.a. homography or projective collineation)
Quaternion
Quaternions are a convenient representation for rotations in 3D spaces.
Rad
Radians
Rotation2
Orthogonal 2x2 matrix with determinant +1, i.e. a member of the circle group $SO(2)$ of special orthogonal matrices
Rotation3
Orthogonal 3x3 matrix with determinant +1, i.e. a member of the 3D rotation group $SO(3)$ of special orthogonal matrices
Turn
Turns
Unit2
2D unit vector
Unit3
3D unit vector
Unit4
4D unit vector
Vector2
Vector type suited for 2D spatial coordinates.
Vector3
Vector type suited for 3D spatial coordinates.
Vector4
Vector type suited for homogeneous 3D spatial coordinates.
Versor
Unit quaternion representing an orientation in $\mathbb{R}^3$

Enums§

Axis2
X or Y axis
Axis3
X, Y, or Z axis
Axis4
X, Y, Z, or W axis
Octant
3D octant
Quadrant
2D quadrant
Sign
Negative, zero, or positive
SignedAxis1
Positive or negative X axis
SignedAxis2
Positive or negative X or Y axis
SignedAxis3
Positive or negative X, Y, or Z axis
SignedAxis4
Positive or negative X, Y, Z, or W axis

Constants§

COMPONENT_INDEX_W
3
COMPONENT_INDEX_X
0
COMPONENT_INDEX_Y
1
COMPONENT_INDEX_Z
2

Traits§

AdditiveGroup
Interface for a group with identity represented by zero, and operation defined by + and -
AdditiveMonoid
Set with identity represented by zero and (associative) binary operation defined by +
AffineSpace
Space of Points (positions) and Vectors (displacements)
Angle
Interface for angle units
Cbrt
Cube root function
Dot
Scalar product (bilinear form) on a Module
ElementaryReflector
Householder transformation
EuclideanSpace
AffineSpace with translations in a (Euclidean) real inner product space
Exp
Exponential function
Field
A (commutative) Ring where $1 \neq 0$ and all non-zero elements are invertible
FixedMatrix2
Convert to fixed precision 2x2 matrix
FixedMatrix3
Convert to fixed precision 3x3 matrix
FixedMatrix4
Convert to fixed precision 4x4 matrix
FixedPoint2
Convert to fixed precision 2D point
FixedPoint3
Convert to fixed precision 3D point
FixedPoint4
Convert to fixed precision 4D point
FixedVector2
Convert to fixed precision 2D vector
FixedVector3
Convert to fixed precision 3D vector
FixedVector4
Convert to fixed precision 4D vector
Group
Set with identity, inverses, and (associative) binary operation
GroupAction
(Right) action of a group on a set
InnerProductSpace
Bilinear form on a VectorSpace
Integer
Ring of integers
LinearMap
Module homomorphism
Matrix
Additional matrix methods
MaybeSerDes
Adds serde Serialize and DeserializeOwned constraints.
MetricSpace
Set of points with distance function
MinMax
Provides min, max, and clamp that are not necessarily consistent with those from Ord. This is provided because f32 and f64 do not implement Ord, so this trait is defined to give a uniform interface with Ord types.
Module
Additive group combined with scalar multiplication
MultiplicativeGroup
Interface for a group with identity represented by one, operation defined by * and /
MultiplicativeMonoid
Set with identity represented by one and (associative) binary operation defined by *
NormedVectorSpace
VectorSpace with vector length/magnitude function
OrderedField
A Field with an ordering
OrderedRing
A Ring with an ordering
Point
Point types convertible to and from a vector type, with difference function that follows from the free and transitive group action
Pow
Unsigned integer power function
Powf
Fractional power function
Powi
Signed integer power function
ProjectiveSpace
Projective completion (homogeneous coordinates)
Real
OrderedField with special functions
Ring
Interface for a ring as a combination of an additive group and a distributive multiplication operation
SignedExt
Function returning number representing sign of self
Sqrt
Square root function
Trig
Trigonometric functions
VectorSpace
Module with scalars taken from a Field

Functions§

matrix2
Construct a 2D matrix
matrix3
Construct a 3D matrix
matrix4
Construct a 4D matrix
point2
Construct a 2D point
point3
Construct a 3D point
point4
Construct a 4D point
report_sizes
Print the sizes of some types
vector2
Construct a 2D vector
vector3
Construct a 3D vector
vector4
Construct a 4D vector