novaphy.math¶
Spatial algebra primitives, axis / angle conversions, and a couple of
vertex-batch helpers. These symbols live at the top level of novaphy;
they are grouped here to mirror newton.math.
Featherstone Spatial Convention¶
NovaPhy spatial-algebra helper functions follow the Featherstone convention:
6D vectors are stored as [angular(3); linear(3)] (angular components
first).
| 6D quantity | Layout | Used by |
|---|---|---|
| Spatial velocity / twist | [ω_x, ω_y, ω_z, v_x, v_y, v_z] |
forward_link_velocities, free-joint joint_qd slices |
| Spatial force / wrench | [τ_x, τ_y, τ_z, f_x, f_y, f_z] |
state.apply_articulation_force, Featherstone helpers |
| Spatial inertia | 6×6 symmetric matrix | spatial_inertia_matrix |
The flat rigid-body state views use a Python-friendly component order instead:
state.body_qd[i] == [vx, vy, vz, wx, wy, wz] and
state.body_f[i] == [fx, fy, fz, tx, ty, tz].
The functions in this namespace are mostly used internally by the
Featherstone helpers (forward_kinematics, forward_dynamics, …).
External code typically only needs them when implementing custom
articulated dynamics on top of NovaPhy primitives.
Quaternion Convention¶
Quaternions are stored as [qx, qy, qz, qw] (Hamilton convention,
xyzw order) — same as Newton and Eigen. Free-joint generalized positions
include a quaternion in this layout:
qfor aFreejoint:[px, py, pz, qx, qy, qz, qw](7 elements)qdfor aFreejoint:[ωx, ωy, ωz, vx, vy, vz](6 elements)
Spatial Algebra¶
| Function | Description |
|---|---|
| skew() | Skew-symmetric matrix from a 3D vector. |
| spatial_cross_force() | Featherstone spatial cross product (motion-on-force). |
| spatial_cross_motion() | Featherstone spatial cross product (motion-on-motion). |
| spatial_inertia_matrix() | Build a 6x6 spatial inertia matrix from mass, COM, and inertia tensor. |
Angle Helpers¶
| Function | Description |
|---|---|
| axis_to_vec3() | Convert an Axis enum to a 3D unit vector. |
| deg2rad() | Degrees → radians. |
| rad2deg() | Radians → degrees. |
Geometry Helpers¶
| Function | Description |
|---|---|
| batch_transform_vertices() | Apply a transform to a batch of vertex positions. |
Compatibility Notes¶
Newton's newton.math Warp-friendly numerics suite is not provided. Items
not yet available include:
safe_div,smooth_min,smooth_max,differentiable_min,differentiable_max,boltzmann- Quaternion utilities (
quat_between_vectors,quat_to_euler,quat_velocity,quat_basis_vector_rotation) - Vector helpers (
vec3_abs,vec_max,vec_min,vec_max_leaky,vec_min_leaky,vec_allclose,vec_inside_limits) - Frame transforms (
transform_twist,transform_wrench,velocity_at_point) normalize_unit_vector,orthonormal_basis_from_normal