Skip to main content

sdf_gradient

Function sdf_gradient 

Source
pub fn sdf_gradient<S: Sdf>(sdf: &S, p: [f64; 3], eps: f64) -> [f64; 3]
Expand description

Estimate the gradient of an SDF at p via central finite differences.

Returns the unnormalized gradient vector (norm ≈ 1 for exact SDFs).