I can not figure it out which triangulation algorithm is used to create these triangles in the attached picture. I think it is not delanuay or ear clipping but which polygon triangulation method create these triangles? Any help?
You need to use Triangle.Net open source library. It features many options including the ability to enrich contour points to maintain a specified triangle aspect ratio.
I don't think it is ear clipping because you can see the difference in the attached example. But they are almost same except two triangles.
Difference between ear clipping and triangulation:
It looks like it decomposes the concave polygon into a union of convex polygons, then creates a triangle fan for each of the convex polygons. But it's difficult to be certain.
Related
I have a 2D layer/section containing the 2D polygons colored in shades of green.
I have another layer containing the 2D polygons colored in shades of blue.
I intend to figure out how different are the two layers. Maybe extracting the layers differential. Can anybody provide an algorithm, library or a hint? I took a look at CGAL, but not quite sure which package to try out.
Unclear the kind of comparison you want to do.
Assuming you want the geometric intersection of the triangulations, an easy solution is to intersect all polygons pairwise. (If the number of triangles is large, use some acceleration technique to avoid all comparisons.)
If you need the triangulated intersection, you can use a clipping algorithm (Sutherland–Hodgman) and triangulate the resulting polygons, which can range in shape from triangles to hexagons. Fortunately, they are convex.
I have a quite specific task.
I need to compute alpha shape of a set of points. (You can frolic with already implemented algorith there)
The point is that I have predefined subsets of points (let's call them details) and I do not want their structure to be changed. For example, suppose these polygons to be details:
Then, the following hulls are ok depending on alpha-radius:
And the following is not:
In brief, I want the structure of specified subsets of points to stay unchanged during reducing the radius.
So, how do you think:
May I use any of already implemented algorithm or should I figure out some specific one?
Is there implemented example of Alpha-Shape algorithm with open source code anywhere? (Alpha-Shape, not Concave hull. It must split contour into several parts when reducing the radius)
Well, Finally I solved this using constrained Delaunay triangulation.
The idea (that Yves Daoust shared in comment to the question) was to use not just Delaunay triangulation during building Alpha shape, but constrained Delaunay triangulation.
Algorithm: In brief, I:
Took convex hull of the promoted polygons
Computed its constrained triangulation. (Constraining segments are polygon's edges)
On this step I used Triangle .NET library for C#. I guess, every popular language has alternatives to it.
Built alpha shape: threw away all triangles where any edge is longer than predefined alpha
Results of my struggles:
Alpha = 1000, alpha shape is just a convex hull
Alpha = 400
Alpha = 30. Only very small concavities are smoothened
Feel free to write me for a deeper explanation, if you wish.
As part of a project I'm working on, I need to generate a 2D triangular mesh.
At the minute, I've implemented a Delaunay triangulation algorithm. I have to input a set of vertices, and it triangulates between them, and that works out great.
However, I'd like to improve on this and instead input a set of vertices that represent the edge of an arbitrary 2D shape (with no holes), and generate a (as uniformly as possible) mesh inside that shape, with varying degrees of precision (target number of triangles).
My Google skills seem to be lacking today, and I haven't found quite what I'm looking for.
Does anyone know of an algorithm / library / concept that will set me on my way?
The triangles of the possibly non-convex 2D shape must not cross the border edges, a Constrained Delaunay triangulation can achieve that.
One solution: Triangulate with Fade [1] and insert the edges of the polygon. A uniform mesh inside the area can then be created using Delaunay Refinement.
[1] http://www.geom.at/fade2d/html/
hth
I want to do the following: I have some faces in the 3D space as polygons. I have a projection direction and a projection plane. I have a convex clipping polygon in the projection plane. I wnat to get a polygon representing the shaddow of all the faces clipped on the plane.
What I do till now: I calculate the projections of the faces as polygons in the projection plane.
I could use the Sutherland–Hodgman algorithm to clip all the singe projected polygons to clip to the desired area.
Now my question: How can I combine the projected (maybe clipped) polygons together? Do I have to use algorithms like Margalit/Knott?
The algorithm should be quite efficient because it has to run quite often. So what algorithm do you suppose?
Is it maybe possible to modify the algorithm of Sutherland–Hodgman to solve the merging problem?
I'm currently implementing this algorithm (union of n concave polygons) using Bentley–Ottmann to find all edge intersections and meanwhile keeping track of the polygon nesting level on both sides of edge segments (how many overlapping polygons each side of the line is touching). Edges that have a nesting level of 0 on one side are output to the result polygon. It's fairly tricky to get done right. An existing solution with a different algorithm design can be found at:
http://sourceforge.net/projects/polyclipping/
I've got a bunch of overlapping triangles from a 3D model projected into a 2D plane. I need to merge each island of touching triangles into a closed, non-convex polygon.
The resultant polygons shouldn't have any holes in them (since the source data doesn't).
Many of the source triangles share (floating point identical) edges with other triangles in the source data.
What's the easiest way to do this? Performance isn't particularly important, since this will be done at design time.
Try gpc, or the General Polygon Clipper Library.
Imagine the projection onto a plane as a "view" of the model (i.e. the direction of projection is the line of sight, and the projection is what you see). In that case, the borders of the polygons you want to compute correspond to the silhouette of the model.
The silhouette, in turn, is a set of edges in the model. For each edge in the silhouette, the adjacent faces will have normals that either point away from the plane or toward the plane. You can check this be taking the dot product of the face normal with the plane normal -- look for edges whose adjacent face normals have dot products of opposite signs with the projection direction.
Once you have found all the silhouette edges you can join them together into the boundaries of the desired polygons.
Generally, you can find more about silhouette detection and extraction by googling terms like mesh silouette finding detection. Maybe a good place to start is here.
I've also found this[1] approach, which I will be trying next.
[1] 2d outline algorithm for projected 3D mesh