geometry2d is a pure Lua implementation of some 2d geometric algorithms:
- Distance between two points
- Left normal to a line segment
- Distance from a point to a line segment
- Distance between two line segments
- Length of a polyline
- Distance from a point to a polyline
- Distance between two polylines
- Is a point in a polygon?
- Polygon orientation
- Polygon centroid
To use it you instantiate a geometry object by telling it what you call your x and y coordinates (which might be 1 and 2) and the index of the first element in a polyline or polygon array.
It's just a collection of geometry bits I've needed from time to time.
luarocks install geometry2d
Lua >= 5.1 or LuaJIT >= 2.0.0.
- Incomplete
- Documentation?
- Many!