Skip to main content

oxiphysics_geometry/csg/
sdfplane_traits.rs

1//! # SdfPlane - Trait Implementations
2//!
3//! This module contains trait implementations for `SdfPlane`.
4//!
5//! ## Implemented Traits
6//!
7//! - `ImplicitSurface`
8//!
9//! 🤖 Generated with [SplitRS](https://github.com/cool-japan/splitrs)
10
11use super::functions::ImplicitSurface;
12use super::functions::dot;
13use super::types::SdfPlane;
14
15impl ImplicitSurface for SdfPlane {
16    fn sdf(&self, p: [f64; 3]) -> f64 {
17        dot(p, self.normal) - self.d
18    }
19    fn gradient(&self, _p: [f64; 3]) -> [f64; 3] {
20        self.normal
21    }
22}