honeycomb_kernels::triangulation

Function check_requirements

Source
pub fn check_requirements(
    n_darts_face: usize,
    n_darts_allocated: usize,
) -> Result<(), TriangulateError>
Expand description

Checks if a face meets the requirements for triangulation.

This function performs several checks on a face before it can be triangulated:

  1. Ensures the face has at least 3 vertices.
  2. Verifies that the face is not already triangulated.
  3. Confirms that the correct number of darts have been allocated for triangulation.

§Arguments

  • n_darts_face - The number of darts in the face to be triangulated.
  • n_darts_allocated - The number of darts allocated for the triangulation process.
  • face_id - The identifier of the face being checked.

§Return / Errors

This function can return:

  • Ok(()) if all checks pass and the face is ready for triangulation.
  • Err(TriangulateError) if any check fails, with a specific error describing the issue.

A failed check can result in the following errors:

  • TriangulateError::UndefinedFace - If the face has fewer than 3 vertices.
  • TriangulateError::AlreadyTriangulated - If the face already has exactly 3 vertices.
  • TriangulateError::NotEnoughDarts - If there aren’t enough darts allocated for triangulation.
  • TriangulateError::TooManyDarts - If there are too many darts allocated for triangulation.