newton.math#

Functions

boltzmann(a, b, alpha)

Compute the Boltzmann-weighted average of two values.

leaky_max(a, b)

Compute a numerically stable, differentiable approximation of max(a, b).

leaky_min(a, b)

Compute a numerically stable, differentiable approximation of min(a, b).

normalize_with_norm(x)

Normalize a vector and return both the normalized vector and the original norm.

orthonormal_basis(n)

Build an orthonormal basis from a normal vector.

quat_between_axes(*axes)

Compute the rotation between a sequence of axes.

quat_between_vectors_robust(from_vec, to_vec)

Robustly compute the quaternion that rotates from_vec to to_vec.

quat_decompose(q)

Decompose a quaternion into wrapped XYZ Euler coordinates.

quat_velocity(q_now, q_prev, dt)

Approximate angular velocity from successive world quaternions (world frame).

safe_div(x, y[, eps])

Safe division that avoids division-by-zero.

smooth_max(a, b, eps)

Compute a smooth approximation of the maximum of two values.

smooth_min(a, b, eps)

Compute a smooth approximation of the minimum of two values.

transform_twist(t, x)

Transform a spatial twist between coordinate frames.

transform_wrench(t, x)

Transform a spatial wrench between coordinate frames.

vec_abs(a)

Compute the elementwise absolute value of a 3D vector.

vec_allclose(a, b[, rtol, atol])

Check if two Warp vectors are all close.

vec_inside_limits(a, lower, upper)

Check if a Warp vector is inside the given limits.

vec_leaky_max(a, b)

Compute the elementwise "leaky" maximum of two 3D vectors.

vec_leaky_min(a, b)

Compute the elementwise "leaky" minimum of two 3D vectors.

vec_max(a, b)

Compute the elementwise maximum of two 3D vectors.

vec_min(a, b)

Compute the elementwise minimum of two 3D vectors.

velocity_at_point(qd, r)

Evaluate the linear velocity of an offset point on a rigid body.