Expand description
Vector mathematics module providing 2D, 3D, and 4D vector operations.
This module provides generic vector types and operations for computer graphics and linear algebra applications. All vectors support standard arithmetic operations, dot products, and component-wise operations.
§Examples
use rs_math3d::vector::{Vector3, FloatVector};
let v1 = Vector3::new(1.0, 2.0, 3.0);
let v2 = Vector3::new(4.0, 5.0, 6.0);
// Vector addition
let sum = v1 + v2;
// Dot product
let dot = Vector3::dot(&v1, &v2);
// Normalization
let normalized = v1.normalize();
Structs§
Traits§
- Cross
Product - Trait for computing the cross product of 3D vectors.
- Float
Vector - Trait for vectors with floating-point components.
- Swizzle2
- Trait for 2D swizzle operations on vectors.
- Swizzle3
- Trait for 3D swizzle operations on vectors.
- Vector
- Generic vector trait defining common vector operations.
Functions§
- distance
- Computes the Euclidean distance between two points.
- dot
- Computes the dot product of two vectors.
- length
- Computes the length (magnitude) of a vector.
- max
- Returns a vector with the maximum components from both input vectors.
- min
- Returns a vector with the minimum components from both input vectors.
- normalize
- Normalizes a vector to unit length.