Function de_pathing::triangulation::triangulate

source ·
pub(crate) fn triangulate(
    bounds: &MapBounds,
    exclusions: &[ExclusionArea]
) -> Vec<Triangle>
Expand description

Returns a triangulation of rectangular area given by bounds shrinked by some distance with exclusion zones.

The returned triangles:

  • do not intersect each other,
  • cover the rectangle given by bounds except areas in exclusions,
  • do not intersect any exclusion area given by exclusions.

§Arguments:

  • bounds - area to be triangulated. This area is first shrinked by [de_objects::EXCLUSION_OFFSET].

  • exclusions - areas not to be included in the triangulation. Individual exclusion areas must not intersect each other, must not touch map boundaries and must be fully inside map boundaries.

§Panics

May panic if any of the aforementioned assumptions does not hold.