use crate::surface3::Surface3;
use crate::vector3::Vector3D;
use std::sync::{RwLock, Arc};
pub trait ImplicitSurface3: Surface3 {
fn signed_distance(&self, other_point: &Vector3D) -> f64 {
let sd = self.signed_distance_local(&self.view().transform.to_local_vec(&other_point));
return match self.view().is_normal_flipped {
true => -sd,
false => sd
};
}
fn signed_distance_local(&self, other_point: &Vector3D) -> f64;
fn closest_distance_local(&self, other_point: &Vector3D) -> f64 {
return f64::abs(self.signed_distance_local(other_point));
}
fn is_inside_local(&self, other_point: &Vector3D) -> bool {
return crate::level_set_utils::is_inside_sdf(self.signed_distance_local(other_point));
}
}
pub type ImplicitSurface3Ptr = Arc<RwLock<dyn ImplicitSurface3>>;