CGAL 2D Delaunay Triangulation: How to get all the edges - triangulation

How to get/iterate over all the edges in the 2D delaunay graph in CGAL (C++)?
For example, in MATLAB this is just edges(dt).

You simply need to use members functions
All_edges_iterator all_edges_begin()
All_edges_iterator all_edges_end()
to get the iterator range over edges.
It is documented on the Triangulation_2 page here
Note that you will get edges incident to the infinite vertex together with finite edges.

Related

Extrapolation delaunay triangulation

Shown Figure (1) is a typical Delaunay triangulation (blue) and it has a boundary line (black rectangle).
Each vertex in the Delaunay triangulation has a height value. So I can calculate the height inside convex hull. I am figuring out a method to calculate the height up to the boundary line (some sort of extrapolation).
There are two things associated with this task
Triangulate up to the boundary point
Figuring out the height at newly created triangle vertices
Anybody come across this issue?
Figure 1:
I'd project the convex hull points of the triangulation to the visible box segments and then insert the 4 box corners and the projected points into the triangulation.
There is no unique correct way to assign heights to the new points. One easy and stable method would be to assign to each new point the height of the closest visible convex hull vertex. Be careful with extrapolation: Triangles of the convex hull tend to have unstable slopes, see the large triangles in front of the below terrain image. Their projection to the xy plane has almost 0 area but due to the height difference they are large and almost 90 degrees to the xy plane.
I've had some luck with the following approach:
Find the segment on the convex hull that is closet to the extrapolation point
If I can drop a perpendicular onto the segment, interpolate between the two vertices of the segment.
If I can not construct the perpendicular, just use the closest vertex
This approach results in a continuous surface, but does not provide 1st derivative continuity.
You can find some code that might be helpful at TriangularFacetInterpolator.java. Look for the interpolateWithExteriorSupport method.

How to extract surface vertices coordinate in fimplicit3 function?

Is it possible to extract the coordinate of surface vertices in the fimplicit3 function in Matlab?
Couldn't found how to do with fimplicit3, but it easier to extract vertices and faces from a surface using isosurface function.
One can follow this tutorial: Implicit curves and surfaces sith Isosurface

Smoothing algorithm, 2.5D

The picture below shows a triangular surface mesh. Its vertices are exactly on the surface of the original 3D object but the straight edges and faces have of course some geometric error where the original surface bends and I need some algorithm to estimate the smooth original surface.
Details: I have a height field of (a projectable part of) this surface (a 2.5D triangulation where each x,y pair has a unique height z) and I need to compute the height z of arbitrary x,y pairs. For example the z-value of the point in the image where the cursor points to.
If it was a 2D problem, I would use cubic splines but for surfaces I'm not sure what is the best solution.
As commented by #Darren what you need are patches.
It can be bi-linear patches or bi-quadratic or Coon's patches or other.
I have found no much reference doing a quick search but this links:
provide an overview: http://www.cs.cornell.edu/Courses/cs4620/2013fa/lectures/17surfaces.pdf
while this is more technical: https://www.doc.ic.ac.uk/~dfg/graphics/graphics2010/GraphicsHandout05.pdf
The concept is that you calculate splines along the edges (height function with respect to the straight edge segment itself) and then make a blending inside the surface delimited by the edges.
The patch os responsible for the blending meaning that inside any face you have an height which is a function of the point position coordinates inside the face and the values of the spline ssegments which are defined on the edges of the same face.
As per my knowledge it is quite easy to use this approach on a quadrilateral mesh (because it becomes easy to define on which edges sequence to do the splines) while I am not sure how to apply if you are forced to go for an actual triangulation.

How can I limit number of triangles in delaunay triangulation?

I want to generate a polyhedron which its vertices are specified. To this end, I use delaunayTriangulation command, but there is a problem and that is high number of triangular faces.So, is there any way to limitation of number of triangular faces? For example,I would like to generate a polyhedron by 8 triangular faces.
Thanks in advance.
My understanding of how a Delaunay triangle is created is that it is using the halfway point, on a lines to the nearest proximal neighbours, to nearest surrounding points to define the edge of the triangle surrounding a point. At its most basic to create 8 triangles you would need 8 points; you would have to accommodate the edge effects but you would have 8 facets or triangles. If you are specifying the vertices of the triangles instead of the central points you will probably get a lot more triangles that required and also may not be getting an appropriate depiction of the analysis you are looking for. Matlab has the capacity to control edge effects in a 2d depiction. HTH, Mark

how to plot 3d graph (network) matlab?

I want to plot a 3d graph in matlab
By graph I mean in the sense of nodes and edges. I have an adjacency matrix as well as a coordinate matrix for every node. Eventually I would hope to colour these nodes and edges
The gplot function is only 2d. The scatter3 function does not allow for edges.
Any ideas?
plot3 allows you to plot points and edges in 3D.
It's now possible (MATLAB R2016b) to plot a node-link graph in 3d, using the graph class. Example:
g = graph(bucky);
plot(g, 'Layout', 'subspace3');
plot3 does not plot graphs, in the sense of nodes and links. I recommend to you igraph, but it scapes of matlab.