Skip to main content

Crate tang

Crate tang 

Source
Expand description

tang — Math library for physical reality

Unified math foundation for geometry kernels, physics engines, and differentiable simulation. Generic over scalar type to support f32, f64, dual numbers (autodiff), and interval arithmetic from the same code.

§Design principles

  • Generic over Scalar type (f32, f64, Dual, Interval)
  • #[repr(C)] everywhere for GPU interop
  • No nalgebra dependency — full control of the stack
  • Block-structured spatial matrices (no 6x6 index gymnastics)
  • Dir3 derefs to Vec3 (no .as_ref() pain)

Structs§

Dir3
A normalized direction vector in 3D space.
Dual
Forward-mode automatic differentiation via dual numbers.
Mat3
3x3 matrix, column-major storage.
Mat4
4x4 matrix, column-major storage.
Point2
A point in 2D space (distinct from Vec2 — points have position, vectors have direction).
Point3
A point in 3D space (distinct from Vec3 — points have position, vectors have direction).
Quat
Quaternion: w + xi + yj + zk
SpatialInertia
Spatial inertia — compact representation.
SpatialMat
6x6 spatial matrix, stored as four 3x3 blocks.
SpatialTransform
Spatial transform: Plücker coordinate transform.
SpatialVec
Spatial (6D) vector — represents either a twist (motion) or wrench (force).
Transform
Rigid body transform (isometry): rotation + translation.
Vec2
Vec3
Vec4

Constants§

GRAVITY

Traits§

Scalar
Trait for scalar types that can be used throughout kern-math.

Functions§

skew
Cross-product matrix [v]× such that [v]× w = v × w