use crate::misc::FloatingPoint;
#[derive(Clone, Debug)]
pub struct CurveIntersectionSolverOptions<T: FloatingPoint> {
pub minimum_distance: T,
pub knot_domain_division: usize,
pub step_size_tolerance: T,
pub cost_tolerance: T,
pub max_iters: u64,
}
impl<T: FloatingPoint> Default for CurveIntersectionSolverOptions<T> {
fn default() -> Self {
Self {
minimum_distance: T::from_f64(1e-5).unwrap(),
knot_domain_division: 64,
step_size_tolerance: T::from_f64(1e-8).unwrap(),
cost_tolerance: T::from_f64(1e-10).unwrap(),
max_iters: 200,
}
}
}
impl<T: FloatingPoint> CurveIntersectionSolverOptions<T> {
pub fn with_minimum_distance(mut self, minimum_distance: T) -> Self {
self.minimum_distance = minimum_distance;
self
}
pub fn with_knot_domain_division(mut self, knot_domain_division: usize) -> Self {
self.knot_domain_division = knot_domain_division;
self
}
pub fn with_step_size_tolerance(mut self, step_size_tolerance: T) -> Self {
self.step_size_tolerance = step_size_tolerance;
self
}
pub fn with_cost_tolerance(mut self, cost_tolerance: T) -> Self {
self.cost_tolerance = cost_tolerance;
self
}
pub fn with_max_iters(mut self, max_iters: u64) -> Self {
self.max_iters = max_iters;
self
}
}