pub mod mathtypes;
use mathtypes::*;
pub use mathtypes::{Dim2D, Dim3D, Dimension};
pub mod primitives;
pub use primitives::*;
pub mod util;
use util::*;
pub mod ops;
use ops::*;
pub mod mods;
use mods::*;
pub trait SDF<T, V: Vec<T>>: Copy {
fn dist(&self, p: V) -> T;
fn normals(self, eps: T) -> EstimateNormalDefault<T, V, Self>
where
CentralDifferenceEstimator<T, V, <V as Vec<T>>::Dimension>: NormalEstimator<T, V>,
{
EstimateNormal::new(self, CentralDifferenceEstimator::new(eps))
}
fn normals_fast(self, eps: T) -> EstimateNormalFast<T, V, Self>
where
TetrahedralEstimator<T, V>: NormalEstimator<T, V>,
{
EstimateNormal::new(self, TetrahedralEstimator::new(eps))
}
fn normals_with<E: NormalEstimator<T, V>>(self, estimator: E) -> EstimateNormal<T, V, Self, E> {
EstimateNormal::new(self, estimator)
}
fn union<O: SDF<T, V>>(self, other: O) -> Union<T, Self, O, HardMin<T>> {
Union::hard(self, other)
}
fn union_smooth<O: SDF<T, V>>(
self,
other: O,
softness: T,
) -> Union<T, Self, O, PolySmoothMin<T>> {
Union::smooth(self, other, softness)
}
fn union_with<O: SDF<T, V>, M: MinFunction<T>>(
self,
other: O,
min_function: M,
) -> Union<T, Self, O, M> {
Union::new(self, other, min_function)
}
fn subtract<O: SDF<T, V>>(self, other: O) -> Subtraction<O, Self> {
Subtraction::new(other, self)
}
fn intersection<O: SDF<T, V>>(self, other: O) -> Intersection<Self, O> {
Intersection::new(self, other)
}
fn round(self, radius: T) -> Round<T, Self> {
Round::new(self, radius)
}
fn elongate(self, axis: Axis, elongation: T) -> Elongate<T, Self, <V as Vec<T>>::Dimension>
where
Elongate<T, Self, <V as Vec<T>>::Dimension>: SDF<T, V>,
{
Elongate::new(self, axis, elongation)
}
fn elongate_multi_axis(self, elongation: V) -> ElongateMulti<V, Self, <V as Vec<T>>::Dimension>
where
ElongateMulti<V, Self, <V as Vec<T>>::Dimension>: SDF<T, V>,
{
ElongateMulti::new(self, elongation)
}
fn translate(self, translation: V) -> Translate<V, Self> {
Translate::new(self, translation)
}
fn rotate<R: Rotation<V>>(self, rotation: R) -> Rotate<R, Self> {
Rotate::new(self, rotation)
}
fn scale(self, scaling: T) -> Scale<T, Self> {
Scale::new(self, scaling)
}
}