simple-vectors 0.3.0

Simple, dimension generic vector math
Documentation
# simple-vectors

[![Crates.io](https://img.shields.io/crates/v/simple-vectors.svg)](https://crates.io/crates/simple-vectors)
[![Docs.rs](https://docs.rs/simple-vectors/badge.svg)](https://docs.rs/simple-vectors)
[![License](https://img.shields.io/crates/l/simple-vectors.svg)](LICENSE)

A simple, dimension-generic vector mathematics library for Rust.

## Features

- **Dimension and type generic**: Works with vectors of any compile-time dimension and scalar type
- **Trait integration**: Implements `VectorSpace`, `DotProduct`, and `InnerSpace` from the `vector-space` ecosystem
- **Optional parsing**: Parsing support via the `parsable` feature

## Installation

Add this to your `Cargo.toml`:

```toml
[dependencies]
simple-vectors = "0.2"
```

## Quick Start

```rust
use simple_vectors::Vector;
use vector_space::InnerSpace;

// Create vectors
let v = Vector::new([1.0, 2.0, 3.0]);
let w = Vector::new([4.0, 5.0, 6.0]);

// Basic arithmetic
let sum = v + w;
let scaled = v * 2.0;

// Vector operations (require `InnerSpace` trait)
let magnitude = v.magnitude();
let normalized = v.normalize();
```

## Examples

### 2D Physics Simulation

```rust
use simple_vectors::Vector;
use vector_space::InnerSpace;

struct Particle {
    position: Vector<f64, 2>,
    velocity: Vector<f64, 2>,
    acceleration: Vector<f64, 2>,
}

impl Particle {
    fn update(&mut self, dt: f64) {
        self.velocity += self.acceleration * dt;
        self.position += self.velocity * dt;
        self.acceleration = Vector::zero();
    }
}
```

### Generic Dimension Mathematics

```rust
use simple_vectors::Vector;
use vector_space::InnerSpace;

fn angle_between<T: num_traits::real::Real, const N: usize>(
    v: Vector<T, N>,
    w: Vector<T, N>,
) -> T {
    (v.dot(w) / (v.magnitude() * w.magnitude())).acos()
}

let v = Vector::new([1.0, 0.0]);
let w = Vector::new([0.0, 1.0]);
let angle = angle_between(v, w);
```

## Integration with vector-space Ecosystem

This crate implements standard vector space traits, making it compatible with other libraries:

```rust
use simple_vectors::Vector;
use vector_space::{distance, InnerSpace};

let point_a = Vector::new([1.0, 2.0]);
let point_b = Vector::new([4.0, 6.0]);

// Calculate distance between points
let dist = distance(point_a, point_b); // 5.0

// Or manually
let diff = point_b - point_a;
let manual_dist = diff.magnitude(); // Also 5.0
```