affn
Affine geometry primitives for strongly-typed coordinate systems.
affn provides the mathematical foundation for working with coordinate systems in scientific computing:
- Reference Centers: Origin points for coordinate systems (e.g., Heliocentric, Geocentric, Topocentric)
- Reference Frames: Orientation of coordinate axes (e.g., ICRS, Ecliptic, Equatorial)
- Cartesian Types: Position (affine points), Direction (unit vectors), Displacement/Velocity (free vectors)
- Spherical Types: Position and Direction in spherical coordinates
Features
- Type Safety: Compile-time enforcement of coordinate system compatibility
- Zero-Cost Abstractions: Thin wrappers with no runtime overhead
- Mathematical Rigor: Clear distinction between positions (affine points) and vectors
Example
use ;
use Heliocentric;
use Ecliptic;
use *;
// Create positions in heliocentric ecliptic coordinates
let earth = new;
let mars = new;
// Compute displacement (Position - Position -> Displacement)
let displacement: = mars - earth;
// Get the direction to Mars
let direction = displacement.normalize.expect;
License
AGPL-3.0-only