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

use crate::util::index_pool::PoolIndex;

#[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, Ord, PartialOrd, bytemuck::Pod, bytemuck::Zeroable)]
pub(crate) struct VertexIndex(pub(crate) u32);

impl PoolIndex for VertexIndex {}

impl VertexIndex {
    pub const INVALID: VertexIndex = VertexIndex(u32::MAX);

    #[inline(always)]
    pub(crate) fn canonical_pair(a: Self, b: Self) -> (Self, Self) {
        if a.0 < b.0 { (a, b) } else { (b, a) }
    }

    #[inline(always)]
    pub(crate) const fn usize(self) -> usize {
        self.0 as usize
    }

    #[inline(always)]
    pub fn is_valid(self) -> bool {
        self.0 != Self::INVALID.0
    }
}