use std::error;
use crate::{PolygonList, TriangleWinding, TriangulationError, formats::ReverseFanFormat};
pub trait FanFormat<'p, P: PolygonList<'p> + ?Sized> {
type Builder: FanBuilder<'p, P> + Sized;
fn initialize(self, polygon_list: &'p P, vi0: P::Index, vi1: P::Index, vi2: P::Index) -> Result<Self::Builder, <Self::Builder as FanBuilder<'p, P>>::Error>;
fn reverse_winding(self) -> ReverseFanFormat<'p, P, Self>
where Self: Sized {
ReverseFanFormat::new(self)
}
}
pub trait FanBuilder<'p, P: PolygonList<'p> + ?Sized>: Sized {
type Output;
type Error: error::Error;
const WINDING: TriangleWinding = TriangleWinding::Counterclockwise;
fn new_fan(&mut self, vi0: P::Index, vi1: P::Index, vi2: P::Index) -> Result<(), Self::Error>;
fn extend_fan(&mut self, vi: P::Index) -> Result<(), Self::Error>;
fn build(self) -> Result<Self::Output, Self::Error>;
fn fail(self, error: &TriangulationError<Self::Error>);
}