use-vector
Install
[]
= "0.0.7"
What belongs here
use-vector owns plain f64 vector primitives and reusable vector operations.
The core type is Vector<const N: usize>, with Vector2, Vector3, and
Vector4 aliases for common dimensions. The current surface includes array
construction, indexing, named accessors for 2D/3D/4D aliases, dot products,
Vector3::cross, norms, normalization, scaling, distances, linear interpolation,
component-wise mapping/zipping, component min/max/clamp/abs helpers, and finite
or NaN checks.
Components are stored privately. Use vector[index], as_array, into_array,
or named accessors such as x(), y(), z(), and w() instead of public
fields.
Scalar division follows normal f64 semantics. Dividing by zero yields infinities or
NaN instead of panicking.
Neighboring crates
| Crate | Responsibility |
|---|---|
use-vector |
Vector primitives and vector operations |
use-matrix |
Matrix primitives |
use-linear |
Higher-level linear algebra algorithms and matrix-oriented workflows |
use-geometry (sibling repo) |
Points, shapes, angles, geometric relationships, and spatial algorithms |
use-physics |
Physical formulas that use vectors |
use-vector intentionally does not add geometry-specific types, matrices, unit-aware
vectors, or domain-specific physics helpers.
Examples
Generic vector magnitude
use Vector;
let vector = from_array;
assert_eq!;
assert_eq!;
Dot and cross products
use ;
let a = new;
let b = new;
assert_eq!;
let x = new;
let y = new;
assert_eq!;
Normalization
use Vector2;
let unit = new
.normalize
.expect;
assert!;
assert!;
Component helpers
use Vector;
let vector = from_array;
let lower = ZERO;
let upper = from_array;
assert_eq!;
assert_eq!;
assert!;
Distance
use Vector3;
let start = ZERO;
let end = new;
assert_eq!;
Status
use-vector is a concrete pre-1.0 crate in the RustUse math workspace. The API stays
small, explicit, and dependency-free so adjacent crates can build on a stable vector core.