What exactly are you trying to do? Are you trying to triangulate a point set so that it represents the shape as depicted above, or are you looking for a convex hull?
This is quite a complex problem to solve, and I would imagine that the solution would vary dependent on your use case. I don’t think Delaunay tetrahedralisation would suit your point set above.
From your picture, I’m guessing that you want them to be treated as surface points, so you could do surface reconstruction. Pretty sure the authors of that paper have the source on github.
There’s also this collection of methods - I’m unsure on licensing though.
Another one that may of some use is the Ball Pivoting algorithm, which should be readily available on github.
If you give me a little more of an idea of your exact use case, and what data you start with beforehand (e.g. in the case above, it looks like you have access to the mesh?) then I may be able to help further
You need face/edge information here, you can’t just give an algorithm a set of points and say “turn this into a mesh”. There are too many ways to connect all the vertices. (edit: I should say, there’s no “easy” way that will always result in the mesh you expect).
…Unless you just want the convex hull, in which case there are several algorithms available online.
Edit: for example: this is like asking “make a polygon from this set of vertices”:
There’s no way to know which of these is the “right” answer:
So basically, I want to run a method that can simulate friction on a surface. This method requires the following properties the surface:
The surface area
The middle (centroid for a triangle)
The normal
That means that if you were to simulate this friction for a MeshPart, you need to estimate the surfaces of a MeshPart.
To make this possible, I wrote a module that can generate vertex points using raycasts (as seen in the picture of the row boat with its raycast vertices). Now I need to divide these into surfaces.
I see. For your use case, I’m unsure you really require any form of reconstruction method.
Assuming you have the asset outside of roblox:
Get the text .obj data and paste it into a ModuleScript
Read the vertex/tri data and create an AABB tree of the mesh and store it for later use
Then, when you need to query with a raycast:
Raycast with Roblox’s method with a whitespace filter for objects that you want to simulate
Using the AABB tree + the mesh data derived from the raycast hit, determine the intersected face using the Moller and Trumbore’s method
You will now have the face you hit and can calculate the surface area, centroid and the normal by reading the data from the face.
Another method, also utilising the .obj data, would be to perform Volumetric Hierarchical Approximate Convex Decomposition to partition the mesh into convex sub-surfaces, for which you could perform the simulation on.
There are several .obj readers available on the DevForum that will speed up the start of your project, but you’ll need to write the AABB tree + ray tracer yourself. There’ll be a lot of code on Github you can utilise for that though - same goes for the VHACD.
If you don’t own the asset, you could write an external parser that works with Roblox’s mesh format. Host it on a server or something for on the fly parsing.
I think I will just go for a convex hull. The only limitation for my use case with the mesh format is that I do not want too many triangles for performance reasons. It is a very cool suggestion nonetheless
I guess that the QuickHull3D answer should be the solution, since that is the end of story. It feels quite uncomfortable to award a solution to 1 answer when 2 are correct (both of you recommended using a convex hull).