Skip to content

Python API Reference

Core Module

import novaphy

Version & Feature Detection

Function Returns Description
novaphy.version() str Engine version string
novaphy.has_ipc() bool True if built with IPC/CUDA support

Scene Construction

ModelBuilder

The entry point for building simulation scenes.

builder = novaphy.ModelBuilder()
builder.add_ground_plane(y=0.0)
idx = builder.add_body(body, transform)
builder.add_shape(shape)
builder.add_articulation(art)
model = builder.build()  # Returns immutable Model

RigidBody

body = novaphy.RigidBody.from_box(mass, half_extents)
body = novaphy.RigidBody.from_sphere(mass, radius)

CollisionShape

shape = novaphy.CollisionShape.make_box(half_extents, body_index)
shape = novaphy.CollisionShape.make_sphere(radius, body_index)

Transform

t = novaphy.Transform.from_translation(np.array([x, y, z]))

Simulation

World

world = novaphy.World(model)
world.step(dt)
state = world.state          # SimState
monitor = world.performance_monitor

FluidWorld

fluid_world = novaphy.FluidWorld(model, [fluid_block], pbf_settings=settings)
fluid_world.step(dt)

IPCWorld

if novaphy.has_ipc():
    ipc_world = novaphy.IPCWorld(model, ipc_config)
    ipc_world.step()

VBDWorld

vbd_world = novaphy.VBDWorld(model, vbd_config)
vbd_world.step()

Articulated Body Algorithms

Function Description
novaphy.forward_kinematics(art, q) Compute body transforms from joint coords
novaphy.inverse_dynamics(art, q, qd, qdd, gravity) Compute required joint torques (RNEA)
novaphy.mass_matrix_crba(art, q) Compute joint-space mass matrix (CRBA)
novaphy.forward_dynamics(art, q, qd, tau, gravity) Compute joint accelerations

Joint Types

novaphy.JointType.Revolute   # 1 DOF rotation
novaphy.JointType.Prismatic  # 1 DOF translation (also: Slide)
novaphy.JointType.Ball       # 3 DOF spherical
novaphy.JointType.Fixed      # 0 DOF rigid
novaphy.JointType.Free       # 6 DOF unconstrained

Fluid Configuration

# Fluid block definition
fluid_block = novaphy.FluidBlockDef()
fluid_block.lower = np.array([x0, y0, z0])
fluid_block.upper = np.array([x1, y1, z1])
fluid_block.particle_spacing = 0.05

# PBF settings
settings = novaphy.PBFSettings()
settings.kernel_radius = 0.2        # SPH kernel support radius
settings.solver_iterations = 4      # Constraint iterations per step

Newton-Aligned Types

Type Description
novaphy.SolverBase Base class for all solvers
novaphy.SolverSemiImplicit Free-body PGS solver
novaphy.SolverFeatherstone Articulated body solver
novaphy.SolverFeatherstoneSettings Featherstone solver config
novaphy.Contacts Unified contact aggregate
novaphy.SolverNotifyFlags Model change notification flags
novaphy.JointSupportMatrix Per-solver joint support table

Performance Monitor

monitor = world.performance_monitor
monitor.enabled = True
monitor.trace_enabled = True

stats = monitor.phase_stats()       # List of PhaseStats
metrics = monitor.last_frame_metrics()  # List of FrameMetric
monitor.write_trace_json("trace.json")

Visualization Module

from novaphy import viz

The viz module provides Polyscope-based 3D visualization utilities used by the demo scripts.

Sensors Module

from novaphy import sensors

Sensor system for reading body state, contact forces, and other simulation data.