PolygonUtils is a module that contains various functions that have to do with polygons whether it includes detecting whether a point is within a polygon or even getting the area of a polygon. All of the functions it includes are listed here.
- Detecting whether a point is in a polygon or not
- Detecting whether a point is on the side of a polygon or not
- Detecting whether two lines collide
- Detecting if a line passes through a polygon
- Detecting if a part is fully inside a polygon
- Aproximating the area of a polygon
- Calculating the centroid of a polygon
A “polygon” is defined as a table of positions in order. (The y axis of a vertex does not matter as it only takes the x and z into account.)
local polygon = {part1.Position, part2.Position, part3.Position}
Here are some examples of it being used.