![dmesh triangulation dmesh triangulation](https://c1.staticflickr.com/3/2863/9153196256_f775253a7c_z.jpg)
I had to make a second pass and flip edges to get something of value. The other problems with ear clipping is that it cannot really work with raw point clouds (while Delaunay is impeccable in 2D context, and it even performs somewhat better when the source is truly stochastic), and also triangulation is somewhat bad (in terms of acute angles and messy looking triangles). I don't use this in a dynamic context, such a convex hull centroid is a murder to determine on the fly. Though I've implemented it in 3D with a clever trick of treating an arbitrary point in space as a quasi-convex-hull-centroid, and using it as a plane normal to determine proper winding and edge path directionality. It also requires extensive preparation and is not suitable for constant retriangulations. If anyone could help me with this I would be very grateful!ĭelaunay may be slower for you but this is only because is more of an academic showcase, and not an industrial solution (edit: someone will say that I'm wrong, but I've tested it extensively, and it's either a poorly designed codebase, or a very poor C# port it does what it says on the tin, however!).Įar clipping as an algorithm has a time complexity that is almost fixed to O(n^2). (Note: all the screenshots show profiler results of the built game.
![dmesh triangulation dmesh triangulation](https://i.pinimg.com/originals/7a/28/ec/7a28ec822b38c3a122936b73c23fad1d.jpg)
But I'm not quite sure if that might help me out here as I would still have the same problem of it getting slower the more holes I make. I was thinking of maybe running some of this in a background thread to help improve performance. However, I have no idea where to start with this! does not provide a way to insert vertices into a triangulation or a way to triangulate only part of a mesh, so I think I'm going to have to write my own solution and possibly also modify. However, because I want wall destruction to be a major part of my game, I'm not happy with this performance. This is to be expected of course, because I'm re-triangulating the mesh every time a new hole is created. The ear clipping library I used is (port of earcut.js to C#) and it worked a lot better! The GC was a lot lower and the simple and fast triangles it generated were perfect for my use case.īut, even though it performs better than Triangle.Net for me, I still have the same problem where the triangulation (and also the polygon clipping) gets slower the more holes I create. So then I found another triangulation method called ear clipping. Profiler for the Triangle.Net library performance is below. Triangle.Net created a lot of GC and it's constrained Delaunay triangulation algorithm was expensive to run the more holes I created in the wall. But when it came to optimising the code, I found that Triangle.Net probably wasn't suited for my use case, where I have to create numerous holes in a wall in real-time. Eventually, I landed on Triangle.Net (port of Triangle to C#) and used that for a while. I have been through triangulation libraries and they were all missing one thing or another. Use the triangles returned from the triangulation algorithm, and the vertices from Clipper, to construct a mesh, along with its normals and UVs.Use the vertices returned from Clipper and feed it into a triangulation algorithm.If the raycast hits the wall, use a Polygon Clipper Library ( Clipper in my case) to cut out that part of the mesh.When the player shoots, send out a raycast.You might be able to apply some sort of function on vertex coordinates to spread them more evenly over map projections while maintaining graph properties, but that's too convoluted for this answer.Hey, so I'm trying to create a wall destruction system similar to that of Rainbow Six Siege, where the player shoots a wall, and a hole is created at that point. Show -> UndirectedEdge, GraphLayout -> "TutteEmbedding"] Then, let us use the points generated to create a mesh (Delaunay Mesh in this case): num = 1000 (*Desired number of points*) The updated version has the more efficient way RandomPoint, num]). ( Original question used a function from MathWorld to generate these points. For instance, let us first generate points pts on a unit sphere. I need to visualize the points of a spherical mesh on a squared plane (this question is different than this one, I believe).