nimby install bumpy
Based on the book http://www.jeffreythompson.org/collision-detection/table_of_contents.php
Mostly used for vector 2d intersections checking for Pixie: https://github.com/treeform/pixie
Supported intersections:
| Shape | Point | Circle | Rectangle | Segment | Polygon | Line | Wedge |
|---|---|---|---|---|---|---|---|
| Point | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Circle | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Rectangle | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Segment | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Polygon | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Line | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Wedge | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
All shapes support overlaps.
ifoverlaps(circle, point):
echo"Circle and point overlap"ifcontains(circle, point):
echo"Circle contains point"And some shapes support intersects functions.
var at: Vec2ifintersects(circle, segment, at):
echo"Circle and segment intersect at ", atvar at: Vec2ifintersects(circle, polygon, at):
echo"Circle and polygon intersect at ", at