lib-math · crate
kinogaki-math
Kinogaki's vectors, points, matrices, quaternions and deterministic elementary functions.
- Repository
- lib-math (kinogaki/lib-math)
- Folder
libs/lib-math/crates/math- Source
- 23 files, 5,513 lines
- Tests
- 11 files, 2,034 lines
What it is
Kinogaki's vectors, points, matrices, quaternions and deterministic elementary functions.
f64 is the default: Vec2, Vec3, Vec4, Mat3, Mat4, Quat, Point2, Point3, Affine3, Frame. The f32 types carry an f suffix (Vec3f, Mat4f) and exist for the GPU boundary; converting between them is always explicit (as_f32, as_f64).
Everything is plain IEEE arithmetic in a fixed order: no fused multiply-add, no reassociation, no SIMD that would change rounding. The vector, matrix and quaternion formulas are glam 0.30's (which Studio used before this crate), so results are bit-identical to it; trigonometry in those types is the platform's std, as glam's was.
units says what the numbers mean: LengthUnit, UpAxis and Units::conversion between two documents' units.
sdk (feature studio-sdk) converts to and from the Studio SDK's plain maths types.
elementary holds the CAD kernel's deterministic sin, cos, atan2, exp, ln, … : built only from + − × ÷ sqrt, identical bits on every OS, with documented error bounds.
Depends on
| Crate | Repository | As | What it is |
|---|---|---|---|
kinogaki-studio-api | SDK | normal | Kinogaki Studio's headless plugin API. |
Third-party
| Crate | Version | Licence | Frozen in | As | Also used by |
|---|---|---|---|---|---|
bytemuck | 1.25.2 | Zlib OR Apache-2.0 OR MIT | lib-ui/vendor | normal | kinogaki-composit-wgpu, kinogaki-geometry, kinogaki-geometry-view, kinogaki-image-pipeline, kinogaki-pixel, kinogaki-ui, kinogaki-ui-wgpu, kinogaki-viewport-api and 2 more |
Used by
| Crate | Repository | As | What it is |
|---|---|---|---|
kinogaki-document | Core and the app | normal | Studio's document: the scene, a tree of objects under one root, and the core network each object of a kind naming a context holds. |
kinogaki-editor | Core and the app | normal | Kinogaki Studio's editor: the document and everything the window shows of it, as parts one frame borrows one by one. |
kinogaki-geometry-view | Core and the app | normal | Geometry, curves and B-reps in the viewport, independent of any GPU API: the SDK's standard values as surface packets (over the SDK's display triangulation and shading normals, so Solid draws what Render renders), the one picker that answers rays and boxes ... |
kinogaki-image-pipeline | Core and the app | normal | ImagePipeline: what renders become on screen and in files. |
kinogaki-lsystem | Mesh | normal | L-systems for the Mesh context's L-System node. |
kinogaki-mesh | Mesh | normal | The Mesh plugin: polygon modelling, Maya's and Houdini's toolset on core's editing API (plugins/mesh/PLAN.md holds the inventory and its groups). |
kinogaki-project | Core and the app | normal | Studio's project files: a document as a Prism document. |
kinogaki-scene | Core and the app | normal | Studio's scene: the document cooked object by object. |
kinogaki-script-exec | lib-script | normal | lib-script's engine: a column (batch) interpreter in safe Rust. |
kinogaki-script-ir | lib-script | normal | lib-script's column IR: typed SSA values (vectors as groups of scalar values) in structured regions; lowering from the checked program; uniform/varying analysis; optimisation; a verifier; and the fault table that maps instructions back to source spans. |
kinogaki-script-lib | lib-script | normal | lib-script's function library. |
kinogaki-sdk-ui | Core and the app | normal | The plugin SDK's UI layer over lib-ui: the SDK's Ui and Painter, its sheets and the host's services, implemented over lib-ui. |
kinogaki-testkit | Core and the app | normal | Kinogaki Studio's core testkit: toy packages written against the SDK alone, so core is tested with no real plugin. |
kinogaki-viewport-core | lib-viewport | normal | Kinogaki viewport core: what a 3D viewport shows, independent of any GPU API or UI toolkit. |
kinogaki-viewport-gpu | lib-viewport | normal | Kinogaki's wgpu viewport renderer: pipelines, retained GPU buffers, offscreen multisampled targets and owned WGSL shaders. |
kinogaki-viewport-ui | lib-viewport | normal | Kinogaki viewport widgets for Kinogaki UI (lib-ui): one/four-view layout, camera navigation, the six-axis view cube, transform gizmo handles and point number labels. |
Modules
affineAffine maps and orthonormal frames.216 lineselementaryDeterministic elementary functions.37 lineselementary::algebraic(private)cbrt, hypot, powi: algebraic functions finished with one double-double correction step and a single rounding.221 lineselementary::dd(private)Double-double building blocks for the elementary functions.289 lineselementary::exp_log(private)exp, exp_m1, ln, ln_1p, log2, log10.282 lineselementary::inverse_trig(private)atan, atan2, asin, acos.288 lineselementary::tables(private)no module doc437 lineselementary::trig(private)sin, cos, tan and degree/radian conversion.379 linesmatrixColumn-major matrices:Mat3andMat4in f64,Mat4fin f32 for the GPU boundary.338 linesmatrix::mat4(private)Mat4: construction (translation, scale, rotation, look-at, projections), decomposition, the inverse and point and vector transforms.504 linesmatrix::ops(private)Arithmetic operators andDisplayfor the matrices.162 linesnoiseCoherent noise in 3D: simplex and Perlin gradient noise, their fractal sums (fBm) and curl noise, as the Noise deformer reads them (Studio's docs/DEFORMERS.md, Noise).278 linesnoise::perlin(private)Improved Perlin noise (Perlin 2002): gradients at the corners of the unit cube around a point, blended by the quintic fade 6t⁵ − 15t⁴ + 10t³, whose first and second derivatives vanish at the cube faces (C² continuous).74 linesnoise::simplex(private)3D simplex noise (Perlin 2001, after Gustavson's reading of it), with hashed gradients instead of a permutation table so any seed works.62 linespointPoints: positions, as distinct from the vectors between them.159 linesquatUnit quaternions for rotations, and Euler angle orders.504 linessdkThis crate's vectors, placements, matrices, units and bounds to and from the Studio SDK's plain maths types (featurestudio-sdk): the one copy every kernel converts with.126 linestriplesVectors as the standard values' plain[f64; 3]triples, and back, without copying (featurepod): a kernel lends itsVec3columns to a value and reads a value's columns asVec3s.51 linesunitsLength units and up axes: what the numbers of a document mean.167 linesvectorVectors:Vec2,Vec3,Vec4in f64, andVec2f,Vec3f,Vec4fin f32 for the GPU boundary.684 linesvector::components(private)Per-component helpers: f64 and f32 conversions andwith_x-style builders that replace one component.48 linesvector::dimension(private)Operations particular to one size: for 3-vectors the axes, the cross product and angles; for 2-vectors the perpendicular, rotation and angles; extending and truncating between sizes.185 lines
Public types and traits
At the crate root
Structs Affine3FrameMaskMat3Mat4Mat4fQuatUnits
Enums EulerOrderLengthUnitUpAxis
By module: 14 public types and traits in 6 modules
affine Affine3Frame
matrix Mat3Mat4Mat4f
noise BasisFractalPlan
quat EulerOrderQuat
units LengthUnitUnitsUpAxis
vector Mask
Besides these, 16 public functions at module level.
