|
Post by scalion on Jan 9, 2022 22:00:58 GMT 1
Hi all,
This library makes it possible to triangulate any polygon, even if it includes intersections to itself. You can create holes in the polygon using other polygons. The use is simplified by the use of a UDT (Polygon_Struct) which allows them to be treated as objects. The triangulations use the "EAR-TRIANGULATION" method, the results are optimized with an "Edge-Swaping" as well as an "Edge-Linking". I would come back with a more complete version to import or export to compatible formats (Unity for example). I will post a new post in this thread for every new release : Post of Last version.
How to use example :
$Library "ManagePolygon"
Global P As Polygon_Struct Global PHole As Polygon_Struct Global Dim T() As Triangle_Vertex_Struct Global Long i, TCount P = NewPolygon(10, 20, 100, 20, 120, 300, 230, 310, 230, 400, 100, 420, 10, 100) PHole = NewPolygon(150, 350, 180, 355, 185, 380, 145, 375) PolygonBuildHole P, PHole TCount = GetTriangulation(P, T()) FullW 1 Do Cls For i = 1 To TCount RGBColor RGB(100, 100, 0) DrawTriangle T(i), True Next i For i = 1 To TCount RGBColor RGB(255, 255, 0) DrawTriangle T(i) Next i RGBColor 0 DrawPolygon P, 200, 0, DPO_ARROWS | DPO_INDEX | DPO_VERTEX Sleep Loop Until Me Is Nothing KillPolygon P KillPolygon PHole
|
|
|
Post by scalion on Jan 12, 2022 18:21:59 GMT 1
New version with IndexingPolygon and IndexingTriangulation :
|
|
|
Post by (X) on Jan 12, 2022 21:52:31 GMT 1
C'est maniaque! Bravo scalion!
|
|
|
Post by scalion on Jan 14, 2022 10:52:02 GMT 1
New feature : ExpandPolygon
|
|
|
Post by (X) on Jan 15, 2022 18:01:48 GMT 1
C'est du beau tavail!
|
|