cadcore-math
Fundamental numeric primitives for the cadcore CAD kernel.
This crate has zero external dependencies — everything is built on
std and const-generic arithmetic.
Design rules
- All lengths are in millimetres unless noted otherwise.
- All angles are in radians unless noted otherwise.
- [
Point3] and [Vec3] are distinct types — the compiler will not let you confuse a location with a direction. - Every function is pure; no global mutable state.
Types at a glance
| Type | Description |
|---|---|
[Point3] |
A location in 3-D space |
[Vec3] |
A free vector (direction + magnitude) |
[UnitVec3] |
A Vec3 guaranteed to have length 1 |
[Mat3] |
Column-major 3×3 matrix (rotations, linear maps) |
[Frame3] |
Right-handed orthonormal frame (origin + 3 axes) |
[Transform3] |
Rigid-body transform: rotation + translation |
[Interval] |
Closed real interval [lo, hi] |
Quick example
use ;
let origin = new;
let dir = try_from_vec.unwrap;
let frame = from_origin_z;
let world_pt = new;
let local_pt = frame.to_local_point;
let back = frame.to_world_point;
assert!;