Geometry
Library · Geometry · server and client scripts
Geometry provides polygon triangulation helpers.
Triangulate
Function
Triangulate(points: buffer, count: number, indices: buffer) -> number
Triangulate splits a simple 2D polygon into triangle indices.
Example
-- Server script.
local indices = Geometry.Triangulate({
Vector2.new(0, 0),
Vector2.new(2, 0),
Vector2.new(2, 2),
Vector2.new(0, 2),
})
if indices then
print(#indices)
end