pub mod aabb;
mod angles;
pub mod arc2;
pub mod arc3;
pub mod circle2;
pub mod circle3;
mod circular3;
pub mod closest;
pub mod curvature;
pub mod curve2;
pub mod curve3;
pub mod intersect;
pub mod intersect3;
pub mod line2;
pub mod line3;
pub mod polyline3;

pub use aabb::Aabb2;
pub use arc2::{Arc2, arc_bounding_box};
pub use arc3::Arc3;
pub use circle2::Circle2;
pub use circle3::Circle3;
pub use closest::{ClosestPoint, ClosestPoint2, ClosestPoint3};
pub use curvature::Curvature;
pub use curve2::{Curve2, Curve2Kind};
pub use curve3::{Curve3, Curve3Kind};
pub use intersect::{IntersectionSet, IntersectionSet2, intersect_curves};
pub use intersect3::{IntersectionSet3, intersect_curves_3};
pub use line2::Line2;
pub use line3::Line3;
pub use polyline3::Polyline3;

#[derive(Debug, thiserror::Error)]
pub enum KernelError {
    #[error("line endpoints coincide within tolerance")]
    DegenerateLine,
    #[error("arc sweep is within tolerance of zero or exceeds 2π")]
    DegenerateArc,
    #[error("circle radius is within tolerance of zero")]
    DegenerateCircle,
    #[error("polyline needs at least two vertices and no zero-length segment")]
    DegeneratePolyline,
}

pub type Result<T, E = KernelError> = core::result::Result<T, E>;
