use std::marker::PhantomData;
use nalgebra::{RealField, U4};
use crate::tessellation::DefaultDivider;
#[derive(Clone, Debug, PartialEq)]
pub struct AdaptiveTessellationOptions<T = f64, D = U4, F = DefaultDivider<T, D>> {
pub norm_tolerance: T,
pub min_divs_u: usize,
pub min_divs_v: usize,
pub min_depth: usize,
pub max_depth: usize,
pub divider: Option<F>,
_marker: PhantomData<D>,
}
impl<T: RealField, D, F> Default for AdaptiveTessellationOptions<T, D, F> {
fn default() -> Self {
Self {
norm_tolerance: T::from_f64(1.58e-1).unwrap(),
min_divs_u: 1,
min_divs_v: 1,
min_depth: 0,
max_depth: 8,
divider: None,
_marker: PhantomData,
}
}
}
impl<T: RealField, D, F> AdaptiveTessellationOptions<T, D, F> {
pub fn with_norm_tolerance(mut self, norm_tolerance: T) -> Self {
self.norm_tolerance = norm_tolerance;
self
}
pub fn with_min_divs_u(mut self, min_divs_u: usize) -> Self {
self.min_divs_u = min_divs_u;
self
}
pub fn with_min_divs_v(mut self, min_divs_v: usize) -> Self {
self.min_divs_v = min_divs_v;
self
}
pub fn with_min_depth(mut self, min_depth: usize) -> Self {
self.min_depth = min_depth;
self
}
pub fn with_max_depth(mut self, max_depth: usize) -> Self {
self.max_depth = max_depth;
self
}
pub fn with_divider(mut self, divider: Option<F>) -> Self {
self.divider = divider;
self
}
}