"Rendering" a polygon with a set of points

Pretty self explanatory, I need a function (or module) that I can give a set of connected points to and then makes a polygon out of parts.

The polygon can be anything ranging from a square to a super complex polygon like this:

The algorithm for arranging the points is already done so if i could just get the rendering function that’d be nice.

Any help is greatly appeaciated!!

1 Like

Just to clear any confusion, I’m not trying to render the polygon onto UI or anything. I want them to be parts in the workspace.

Hey, it’s late for me so I can’t really think of any ideas on how to implement it, but I suggest trying to make it out of triangles. Maybe by finding the closest two points to each point and then making a triangle out of that? Just as a general idea.
To make triangles, you could use wedge parts, in theory.
If you want it to be one part, you should also use the BasePart:UnionAsync() function at the end.

You could use an EditableMesh and a Polygon Triangulation algorithm.

1 Like

That’s basically what I said in my post (I said parts but you know whatI mean).

I wanna render the polygon using wedges (using EgoMoose’s draw3dtriangle function), but I’m not the best at math so I don’t really know how I’d script a triangulation algorithm?

I’m pretty much looking for a function to render a polygon by giving it points, but looking through the DevForum most of the functions I found were weirdly coded or straight up not working with the polygons I give them.

Can you give me some info on how the points are stored? Like is it specified in the data which points are connected with which?

It’s a table that stores the positions of the verticies and arranges them like this: