novaphy.geometry¶
Collision shapes, broadphase modes, collision-pipeline entry points, and
contact buffers. Core symbols are available at the top level of novaphy;
the importable novaphy.geometry module also provides compatibility aliases
and HydroelasticSDF.
import novaphy
shape = novaphy.CollisionShape.make_box(half_extents, body_index)
pipeline = novaphy.CollisionPipeline(model, broad_phase="sap")
contacts = pipeline.contacts()
pipeline.collide(state, contacts)
Pipeline Overview¶
A whole-model collision pass flows through the explicit pipeline:
Model shapes + SimState
│
▼
CollisionPipeline.collide(state, contacts)
│
├── broadphase candidates
├── narrowphase contact generation
▼
Contacts.rigid_contact_* / Contacts.soft_contact_*
- CollisionShape describes a shape, material, flags, local pose, and owning body/link.
- BroadPhaseMode selects
"explicit","nxn"/"all_pairs", or"sap"candidate generation. - CollisionPipeline owns the collision options and allocates contact storage sized for the bound model.
- Contacts exposes rigid contacts as
rigid_contact_*columns and particle / soft-point contacts assoft_contact_*columns.
Most solvers do not run collision internally. Call
pipeline.collide(state, contacts) before solver.step(...) whenever those
solvers should consume contacts. SolverIPC is the exception: libuipc runs
its own collision handling and ignores the NovaPhy Contacts argument.
Shapes and Bounds¶
| Class | Description |
|---|---|
| AABB | Axis-aligned bounding box. |
| CollisionShape | Collision shape descriptor. |
| HydroelasticSdfConfig | Validated runtime configuration consumed by CollisionPipeline. |
| Mesh | Triangle mesh wrapper. |
HydroelasticSDF |
Compatibility namespace whose nested Config dataclass only stores hydroelastic SDF option values. |
| ShapeConfig | Shape parameters used by builder helpers. |
| ShapeFlags | Shape visibility and collision bit flags. |
| ShapeType | Shape type enumeration. |
For hydroelastic SDF collision, pass the executable top-level
HydroelasticSdfConfig to
CollisionPipeline. novaphy.geometry.HydroelasticSDF.Config is a
compatibility value container and is not the pipeline's runtime config type.
Collision Pipeline¶
| Class | Description |
|---|---|
| BroadPhaseMode | Broadphase mode enum. |
| BroadPhasePair | Candidate overlap pair from exposed SAP broadphase utilities. |
| CollisionFilterPair | Disabled shape pair entry. |
| CollisionPipeline | Configurable broad + narrow phase pipeline. |
| SweepAndPrune | Standalone Sweep-and-Prune broadphase utility. |
Contact Data¶
| Class | Description |
|---|---|
| Contacts | Structure-of-arrays contact aggregate consumed by solvers. |
Hydroelastic SDF Tables¶
Hydroelastic SDF contact generation uses marching-cubes lookup tables in
novaphy/src/collision/cuda/collision_cuda_hydro_mc_tables.cuh. The file is a
shared source for both backends: CUDA compiles the arrays as device constant
memory, while the CPU collision path includes the same header with the CUDA
qualifiers disabled. This keeps CPU/CUDA hydro surface extraction on the same
case table.
The table contents are generated from the standard 256-case marching-cubes triangulation table and flattened into:
kHydroMcTriRange: prefix offsets for each cube case.kHydroMcFlatEdgeVerts: ordered edge endpoint pairs for all emitted triangles.kHydroMcCornerOffsets: the cube-corner order used by both CPU and CUDA code, with x/y/z stored in bit order.
When updating the tables, regenerate the full table from the same 256-case source instead of hand-editing individual cases. Keep the corner order and edge endpoint convention unchanged, update the count constants, and run the hydroelastic contract tests on both CPU and CUDA-capable builds:
python -m pytest python/tests/test_newton_hydroelastic_contacts.py -q -k "hydroelastic_sdf or generated_hydro_sdf or complex_pairs"
python -m pytest python/tests/test_collision.py -q
Functions¶
| Function | Description |
|---|---|
| compute_inertia_mesh() | Newton-aligned solid-mesh inertia integrator. |
Compatibility Notes¶
The following Newton-side newton.geometry APIs are not yet provided by
NovaPhy:
- Per-pair narrowphase functions (
collide_box_box,collide_sphere_sphere,collide_capsule_*, etc.) BroadPhaseAllPairs,BroadPhaseExplicit- Public
NarrowPhaseclass and top-levelcollide_shapes() - Per-contact Python object classes such as
ContactPoint/ContactManifold - Analytical SDF helper functions (
sdf_box,sdf_sphere, etc.) - BVH builders (
build_bvh_shape/particle,refit_bvh_shape/particle) compute_inertia_shape(general),compute_offset_mesh,transform_inertiaMATCH_BROKEN,MATCH_NOT_FOUNDconstants