Expand description
Implicit surface representations and operations.
This module provides Signed Distance Functions (SDFs) for common geometric primitives, Constructive Solid Geometry (CSG) boolean operations, smooth blending, isosurface extraction via Marching Cubes, Radial Basis Function (RBF) implicit surfaces, and sphere-tracing ray marching.
§Quick start
use oxiphysics_geometry::implicit_surfaces::{ImplicitSurface, SphereSDF};
let sphere = SphereSDF::new([0.0, 0.0, 0.0], 1.0);
assert!(sphere.eval([0.0, 0.0, 0.0]) < 0.0); // inside
assert!(sphere.eval([2.0, 0.0, 0.0]) > 0.0); // outsideStructs§
- BoxSDF
- Axis-aligned box SDF centred at the origin.
- CylinderSDF
- Infinite cylinder SDF along the Y axis centred at the origin.
- DifferenceSDF
- CSG difference of two implicit surfaces: f = max(A, −B).
- IntersectionSDF
- CSG intersection of two implicit surfaces: f = max(A, B).
- OffsetSDF
- Offset (shell) SDF: expands or shrinks a shape by a fixed distance.
- RBFImplicit
- Radial Basis Function (RBF) implicit surface.
- Smooth
UnionSDF - Smooth (C¹) union of two implicit surfaces using polynomial blending.
- SphereSDF
- Sphere SDF: f(p) = |p − center| − radius.
- TorusSDF
- Torus SDF centred at the origin, lying in the XZ plane.
- UnionSDF
- CSG union of two implicit surfaces: f = min(A, B).
Traits§
- Implicit
Surface - Trait for implicit surface representations (Signed Distance Functions).
Functions§
- is_
inside - Test whether a point is inside a closed implicit surface.
- marching_
cubes - Extract an isosurface from an implicit SDF using the Marching Cubes algorithm.
- ray_
march - Sphere-trace a ray against an implicit surface.
- surface_
bbox - Compute the axis-aligned bounding box of a level-set surface by sampling.
- surface_
normal - Estimate the outward unit normal of an implicit surface at
pusing central differences with step sizeeps.