Skip to main content

Sdf

Trait Sdf 

Source
pub trait Sdf {
    // Required method
    fn distance(&self, p: [f64; 3]) -> f64;

    // Provided method
    fn normal(&self, p: [f64; 3]) -> [f64; 3] { ... }
}
Expand description

A Signed Distance Field: maps a 3-D point to the signed distance to the nearest surface (negative inside, positive outside).

Required Methods§

Source

fn distance(&self, p: [f64; 3]) -> f64

Return the signed distance from point p to the nearest surface.

Provided Methods§

Source

fn normal(&self, p: [f64; 3]) -> [f64; 3]

Return the surface normal at point p via central-difference gradient.

The default implementation uses a small finite-difference epsilon of 1e-5.

Implementors§