Alpha shapes from weighted Delaunay Triangulation - c++

I am looking for an algorithm to solve alpha shapes from weighted delaunay triangulation (assuming we have weighted DT) in 2D and 3D. I've looked at a few online links that provide complicated explanations. It'll be great if i can get pseudo code of the algorithm with good explanation.

You can try to use CGAL that provides both 3D and 2D weighted alpha-shapes.
Examples in 3D are available here and here.
The 2D case is similar.

Alpha shapes is alpha value and every edges exceeding alpha. Hence you can remove those edges. I don't think it needs dt. a weighted dt.

Related

3d surface mesh triangulation

Does anyone know an algorithm to generate a 3d surface mesh given a set of vertices? My project requires that we construct an irregular 3d object in OpenGL and I am having trouble finding out how to do this using triangulation.
You better with a library like cgal. It implements the boywer-watson algorithm but with tetrahedrons. It's a very fast incremental triangulation. Then find the convex hull and remove edges exceeding alpha.

Triangulation 3D algorithm

I have thousands of polygon on 3D space which contains more than 3 vertex. I want partition each polygon into a set of triangles. I have been looking all over the internet and I can not find any algorithm on 3D that does that. I have found many algorithms working on 2D like ear clipping and Delaunay triangulation. But I can not find any algorithm for 3D.
I saw many same questions on this site which answered with "use the Delaunay triangulation algorithm". But I have seen that this algorithm is for 2D:
http://www.geom.uiuc.edu/~samuelp/del_project.html
Implement an algorithm for finding the constrained Delaunay triangulation of a given point set in two dimensions.
What 3D Triangulation algorithm can I use?
I am using OpenGL with C++.
You can use the GLUTesselator:
http://www.glprogramming.com/red/chapter11.html
Also note that a 3D polygon will have many faces which can be translated onto an axis aligned 2D plane, triangulated, and then the results translated back into the plane defined by the face.
You can use a delaunay triangulation but with tetrahedons. Basically use Bowyer Watson with circumspheres:http://blog.mmacklin.com/tag/meshing/.

Polygon Offset/ Minkowski sum with a sphere algorithm

I am looking for a accurate polygon offset algorithm for 3D polygons, convex and non convex. This can also be achieved with Minkowski sum with a sphere. I know CGAL provide a minkowski package.
However, is there an easy algorithm that I can implement to achieve this task of polygon offse in 3D.
Thanks.
Cheers,
CB
There are easy-ish approaches for offsetting convex polyhedra -- you just move each polygon along its normal, convert edges into cylindrical arcs, and vertices into spherical sectors. For concave geometry, though, this will produce intersecting and degenerate faces. If all you want to do is render then that's okay... but if you intend to do anything interesting with the offset geometry, you really need the big guns provided by things like CGAL.

Polygon Partitioning vs Triangulation

I recently asked this question about how to cut down a concave polygon to convex ones, and I was suggested to do Triangulation or Polygon Partitioning.
The library I'm using (SFML\Box2D) only takes convex shapes.
This is what I want to know:
Is Polygon Partitioning, or Triangulation of Polygons faster?
How does Polygon Partitioning work/ How do you do it?
Don't forget Triangulation doesn't require convex shapes to be made either...
Not a full answer to your question, but if you have a general polygon (concave, convex, whatever) and you are looking to triangulate it (for subsequent openGL style rendering perhaps) you could look into "constrained Delaunay triangulation" packages. One such example is the Triangle package, which is reputed to be fast and robust.
As I understand it, the algorithms used in Triangle exhibit O(nlogn) runtime complexity.
Polygon partitioning splits your polygon into convex polygons.
Triangulation splits it into triangles.
As far as I understand, partitioning into triangles requires that you first perform polygon partitioning, since partitioning convex polygon into triangles is relatively trivial.
Splitting polyon into convex polygons is the hard part.
I have written a program that does both for a class and if you want I can dig it up.
Here's my code:
https://github.com/meshko/triangulator/tree/master/som
I haven't touched in 10 years so beware of.

OpenGL lighting question?

Greetings all,
As seen in the image , I draw lots of contours using GL_LINE_STRIP.
But the contours look like a mess and I wondering how I can make this look good.(to see the depth..etc )
I must render contours so , i have to stick with GL_LINE_STRIP.I am wondering how I can enable lighting for this?
Thanks in advance
Original image
http://oi53.tinypic.com/287je40.jpg
Lighting contours isn't going to do much good, but you could use fog or manually set the line colors based on distance (or even altitude) to give a depth effect.
Updated:
umanga, at first I thought lighting wouldn't work because lighting is based on surface normal vectors - and you have no surfaces. However #roe pointed out that normal vectors are actually per vertex in OpenGL, and as such, any POLYLINE can have normals. So that would be an option.
It's not entirely clear what the normal should be for a 3D line, as #Julien said. The question is how to define normals for the contour lines such that the resulting lighting makes visual sense and helps clarify the depth?
If all the vertices in each contour are coplanar (e.g. in the XY plane), you could set the 3D normal to be the 2D normal, with 0 as the Z coordinate. The resulting lighting would give a visual sense of shape, though maybe not of depth.
If you know the slope of the surface (assuming there is a surface) at each point along the line, you could use the surface normal and do a better job of showing depth; this is essentially like a hill-shading applied only to the contour lines. The question then is why not display the whole surface?
End of update
+1 to Ben's suggestion of setting the line colors based on altitude (is it topographic contours?) or based on distance from viewer. You could also fill the polygon surrounded by each contour with a similar color, as in http://en.wikipedia.org/wiki/File:IsraelCVFRtopography.jpg
Another way to make the lines clearer would be to have fewer of them... can you adjust the density of the contours? E.g. one contour line per 5ft height difference instead of per 1ft, or whatever the units are. Depending on what it is you're drawing contours of.
Other techniques for elucidating depth include stereoscopy, and rotating the image in 3D while the viewer is watching.
If your looking for shading then you would normally convert the contours to a solid. The usual way to do that is to build a mesh by setting up 4 corner points at zero height at the bounds or beyond then dropping the contours into the mesh and getting the mesh to triangulate the coords in. Once done you then have a triangulated solid hull for which you can find the normals and smooth them over adjacent faces to create smooth terrain.
To triangulate the mesh one normally uses the Delaunay algorithm which is a bit of a beast but there does exist libraries for doing it. The best of which I know of is the ones based on Guibas as Stolfi papers since its pretty optimal.
To generate the normals you do a simple cross product and ensure the facing is correct and manually renormalize them before feeding into the glNormal.
The in the old days you used to make a glList out of the result but the newer way is to make a vertex array. If you want to be extra flash then you can look for coincident planar faces and optimize the mesh down for faster redraw but thats a bit of a black art - good for games, not so good for CAD.
(thx for bonus last time)