cadcore-math
Fundamental math primitives for the cadcore CAD kernel.
Zero external dependencies. Everything in cadcore is built on top of this crate.
Types
| Type | Description |
|---|---|
Point3 |
Location in 3-D space (mm) |
Vec3 |
Free vector — direction + magnitude |
UnitVec3 |
Unit-length vector, enforced at construction |
Mat3 |
3×3 column-major matrix (rotation, linear maps) |
Frame3 |
Right-handed orthonormal frame (origin + 3 axes) |
Transform3 |
Rigid-body transform: rotation + translation |
Interval |
Closed real interval [lo, hi] |
Constants: EPS, PI, TAU.
Usage
[]
= "0.1"
use ;
// Build a right-handed frame from an origin and a Z axis
let origin = new;
let axis = try_from_vec.unwrap;
let frame = from_origin_z;
// Vector arithmetic
let a = new;
let b = new;
let c = a.cross; // (0, 0, 1)
let d = a.dot; // 0.0
// 3×3 rotation matrix
let rot = rotation_z; // 90° around Z
let v = rot * new; // (0, 1, 0)
// Interval utilities
use Interval;
let i = new;
assert!;
let = i.lerp_pair; // 2.5, 7.5
Part of cadcore
This crate is a building block. If you need the full kernel (sweep, STEP export), use the cadcore facade instead:
[]
= "0.1"
License
PolyForm Noncommercial License 1.0.0
Free for research, education, and non-commercial use. Commercial licensing: dmytroyatskovskiy@gmail.com