pub trait Sdf: Send + Sync {
// Required method
fn distance(&self, p: [f64; 3]) -> f64;
// Provided methods
fn gradient(&self, p: [f64; 3]) -> [f64; 3] { ... }
fn normal(&self, p: [f64; 3]) -> [f64; 3] { ... }
}Expand description
Signed distance function: negative inside the shape, positive outside.