simple-vectors 0.4.0

Simple, dimension generic vector math
Documentation

simple-vectors

Crates.io Docs.rs License

Simple, dimension-generic vector mathematics for Rust.

Types

  • Vector<T, N> - generic fixed-size vector wrapping [T; N]
  • Point<T, N> - generic affine point wrapping [T; N]

Features

  • Dimension and type generic: Works with any compile-time dimension and scalar type
  • Affine geometry: Point - Point -> Vector, Point + Vector -> Point
  • Trait integration: Implements VectorSpace, DotProduct, InnerSpace, Basis<I> from the vector-space ecosystem
  • Optional parsing: Parsing support via the parsable feature

Example

use simple_vectors::{Vector, Point};

let a = Point::new([1.0, 2.0, 3.0]);
let b = Point::new([4.0, 6.0, 8.0]);
let displacement: Vector<f64, 3> = b - a;

let v = Vector::new([1.0, 2.0, 3.0]);
let w = Vector::new([4.0, 5.0, 6.0]);
let dot = v * w;
let scaled = v * 2.0;

AI-assisted development

This crate is designed for use with AI coding assistants. Consistent trait implementations, no implicit behavior, and standard VectorSpace/InnerSpace trait integration make it straightforward for AI to work with. The dimension-generic design means a single type works for 2D, 3D, or any other dimensionality.