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.

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.

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.