mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Supports closed line segments, rects and freely drawn polygons.
Added the correct way of generating a point within a polygon with trial and error
Added a way to get the surface area.
Added a helper class (_ZONE_TRIANGLE), which shouldn't ever be used on its own. It's there to support the update ZONE_POLYGON.
Some test code, assuming there's a poygon drawn in the mission editor called "poly":
```Lua
-- make a new zone from a drawing
poly = ZONE_POLYGON:NewFromDrawing("poly")
-- draw the zone for everyone, include the individual triangles that make up the polygon
poly:DrawZone(-1, {1,0,0}, 1, {1,0,0}, 255, 4, false, true)
-- generate 500 random points, evenly distributed in the polygon
for i=1, 500 do
COORDINATE:NewFromVec2(poly:GetRandomVec2()):CircleToAll(1000)
end
-- remove the drawing from the game
poly:UndrawZone()
```
You can find documentation for MOOSE in the following places:
- Generated documentation of all MOOSE classes:
- For the
masterbranch: MOOSE_DOCS - For the
developbranch: MOOSE_DOCS_DEVELOP
- For the
- Documentation:
- The old Guides can be found in our archive.
- Visit our new documentation at the MOOSE GitHub page.
- Overview of all MOOSE repositories on GitHub.
Languages
Lua
99.9%