mirror of
https://github.com/bevyengine/bevy
synced 2024-12-21 02:23:08 +00:00
fcaa271693
# Objective - This PR adds the ability to determine whether a `Polygon<N>` or `BoxedPolygon` is simple (aka. not self-intersecting) by calling `my_polygon.is_simple()`. - This may be useful information for users to determine whether their polygons are 'valid' and will be useful when adding meshing for polygons. - As such this is a step towards fixing #15255 ## Solution - Implemented the Shamos-Hoey algorithm in its own module `polygon`. ## Testing - Tests are included, and can be verified visually. --- ## Performance - The Shamos-Hoey algorithm runs in O(n * log n) - In reality, the results look more linear to me. - Determining simplicity for a simple polygon (the worst case) with less than 100 vertices takes less than 0.2ms. ![image](https://github.com/user-attachments/assets/23c62234-abdc-4710-a3b4-feaad5929133) |
||
---|---|---|
.. | ||
bounding | ||
curve | ||
primitives | ||
rects | ||
sampling | ||
affine3.rs | ||
aspect_ratio.rs | ||
common_traits.rs | ||
compass.rs | ||
cubic_splines.rs | ||
direction.rs | ||
float_ord.rs | ||
isometry.rs | ||
lib.rs | ||
ops.rs | ||
ray.rs | ||
rotation2d.rs |