remesh 0.0.5

Isotropic remeshing library
Documentation
// SPDX-License-Identifier: MIT OR Apache-2.0
// Copyright (c) 2025 lacklustr@protonmail.com https://github.com/eadf

pub trait IndexType: std::fmt::Debug + std::fmt::Display + Copy + TryInto<u32> {}

// Range checked conversions to u32 (on 32/64-bit platforms)
impl IndexType for usize {}
impl IndexType for u64 {}

// Zero-cost conversions to u32 (on 32/64-bit platforms)
impl IndexType for u32 {}
impl IndexType for u16 {}
// Runtime-checked conversion for ergonomics
impl IndexType for i32 {}

// Define a trait that associates each scalar type with its corresponding vector type
pub trait ScalarType: vector_traits::prelude::GenericScalar
where
    Self::Vec3: vector_traits::prelude::SimdUpgradable<Simd = Self::Vec3Simd>,
{
    const EPSILON_SQ: Self;
    type Vec3: vector_traits::prelude::SimdUpgradable<Scalar = Self> + Default;
    type Vec3Simd: vector_traits::prelude::GenericVector3<Scalar = Self> + Default;
}

// Implementation for f32 -> glam::Vec3
impl ScalarType for f32 {
    const EPSILON_SQ: Self = f32::EPSILON * f32::EPSILON;
    type Vec3 = vector_traits::glam::Vec3;
    type Vec3Simd = vector_traits::glam::Vec3A;
}

// Implementation for f64 -> glam::DVec3
impl ScalarType for f64 {
    const EPSILON_SQ: Self = f64::EPSILON * f64::EPSILON;
    type Vec3 = vector_traits::glam::DVec3;
    type Vec3Simd = vector_traits::glam::DVec3;
}