Skip to content

C++ API Reference

Overview

NovaPhy's C++ API is organized under the novaphy namespace. All types use float (never double) with Eigen *f type aliases.

Type Aliases

Defined in include/novaphy/novaphy_types.h:

namespace novaphy {
    using Scalar = float;
}

Defined in include/novaphy/math/math_types.h:

namespace novaphy {
    using Vec3f = Eigen::Vector3f;
    using Mat3f = Eigen::Matrix3f;
    using Quatf = Eigen::Quaternionf;
    using VecXf = Eigen::VectorXf;
    using MatXf = Eigen::MatrixXf;
}

Core Types

RigidBody (core/body.h)

Stores mass, inertia, position, velocity, and material properties for a single rigid body.

CollisionShape (core/shape.h)

Shape types: SphereShape, BoxShape, PlaneShape, CapsuleShape, CylinderShape, MeshShape.

Joint (core/joint.h)

Joint types: Revolute, Prismatic (Slide), Ball, Fixed, Free.

Articulation (core/articulation.h)

Defines a kinematic tree of joints and bodies for articulated body simulation.

Model (core/model.h)

Immutable simulation model. Created by ModelBuilder::build().

ModelBuilder (core/model_builder.h)

Mutable scene description. Add bodies, shapes, joints, and articulations.

Collision

IBroadphase (collision/ibroadphase.h)

Interface for broadphase collision detection.

SweepAndPrune (collision/broadphase.h)

Default broadphase using sort-based Sweep and Prune.

Narrowphase (collision/narrowphase.h)

Dispatches to specialized collision pair algorithms and generates contact points.

Dynamics

SolverBase (dynamics/solver_base.h)

class SolverBase {
public:
    virtual void step(const Model&, SimState&, const Control&, float dt,
                      const Vec3f& gravity) = 0;

    virtual void step(const Model&, const SimState& in, SimState& out,
                      const Control*, Contacts*, float dt, const Vec3f& gravity);

    virtual void notify_model_changed(SolverNotifyFlags flags);
    virtual void update_contacts(Contacts& out, const SimState* state) const;
    virtual JointSupportMatrix joint_support() const;
};

SolverSemiImplicit (dynamics/semi_implicit/solver_semi_implicit.h)

Free-body Sequential Impulse solver with PGS iteration.

SolverFeatherstone (dynamics/featherstone/solver_featherstone.h)

Articulated body solver using Featherstone algorithms.

SolverXPBD (dynamics/xpbd/solver_xpbd.h)

Extended Position Based Dynamics solver.

Fluid

PBFSolver (fluid/pbf_solver.h)

Position Based Fluids solver with SPH kernels and iterative density constraint.

Simulation

World (sim/world.h)

Main simulation world. Owns solver, manages broadphase/narrowphase, and steps the simulation.

SimState (sim/state.h)

Simulation state: body positions, velocities, joint coordinates.

PerformanceMonitor (sim/performance_monitor.h)

Opt-in per-phase timing and Chrome/Perfetto trace export.

IO

URDFParser (io/urdf_parser.h)

Parse URDF files into NovaPhy articulation structures.

OpenUSDImporter (io/openusd_importer.h)

Import scenes from OpenUSD format.

Building with CMake

find_package(novaphy CONFIG REQUIRED)
target_link_libraries(your_target PRIVATE novaphy::core)

# If using the VBD module:
# target_link_libraries(your_target PRIVATE novaphy::vbd)

Or via add_subdirectory:

add_subdirectory(/path/to/NovaPhy)
target_link_libraries(your_target PRIVATE novaphy::core)