Jump to content

OrderVerticesClockwise

From CMM Wiki
Return to CMM Command Reference
Environment: Mission Scripting
Function: OrderVerticesClockwise
Function Description: Orders a list of vertices in clockwise orientation by calculating the angle of each point relative to the centroid of the vertex list, sorting them by angle, and returning a new table with vertices arranged in clockwise order.
File Location: cmm.positionFunctions.lua
Syntax: CMM.OrderVerticesClockwise( table vertices )
Return Value: table
Parameters: Name Description
verticesA list of vec2 (.x, .y) or vec3 (.x, .y, .z) points to be ordered; each point has .x and either .y or .z components.
Example: CMM.OrderVerticesClockinwise({vec2(1,2), vec2(3,4), vec2(5,6)})
Example Description: Orders three 2D points in clockwise orientation using centroid-based angle sorting.
Related Functions:
Notes: