Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Newbie question about CGAL Hierarchy Triangulation 3.

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Newbie question about CGAL Hierarchy Triangulation 3.


Chronological Thread 
  • From: Juliano Costa <>
  • To:
  • Subject: Re: [cgal-discuss] Newbie question about CGAL Hierarchy Triangulation 3.
  • Date: Wed, 5 Aug 2009 09:05:39 -0300
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=Sbj8n0v1RFm6BW6R9NESxLtQrsCn40ofQ5jGKAf/f5A+s32BizIVBESdKNwiaMWABS UWmLE9nclPsi1JZYUSU6xLugwLJSIiaqBE61NB43ZFuzJb51D59o1r8XqYqo8o5etHPm 2gKZW1+epWkoojYXy8fSYpSpf07Bevq9fW2BI=

Hello Manuel,
 
Thanks a lot for your attention,
 
I've been trying to researching the CGAL::Delaunay_triangulation_3 targeting achieve a triangulated surface of a huge points cloud on 3D space.
Then I wrote a small software first to test it with small known objects like 3d boxes, cubes, spheres ...
 
To test the result I'm generating an .OBJ (wavefront) file to visualyze the result on the Meshlab (http://meshlab.sourceforge.net/)  
since I'm working on Windows.
 
My first concern is that the CGAL::Delaunay_triangulation_3 result for a regular box was giving me 1 diagonal of the given box when using 
the Edges iterator. It was strange for me, because the "sphere" passing through the 2 vertices of the diagonal would contain other points 
of the box, right?!!! So, it shouldn't be a Delaunay result ...
 
Well, I ignored this issue and proceed with my intend so I used the DelaunayTriangleHierarchy::Finite_facets_iterator like this:
 
//On inserting points I'm setting the Vertex_hanlde->info with an "unsigned long" value as index. 
 
//I need to get the triangles points indexes:
CPUInt64_t  _indexA,_indexB,_indexC;
CPUInt64_t* _iPointsIndexes[3];
_iPointsIndexes[0] = &_indexA;
_iPointsIndexes[1] = &_indexB;
_iPointsIndexes[2] = &_indexC;
 
//having DelaunayTriangleHierarchy _delaunayTrianguleHierarchy;
DelaunayTriangleHierarchy::Finite_facets_iterator _fit = _delaunayTriangule.finite_facets_begin(); 
 
while(_fit !=  _delaunayTriangule.finite_facets_end())
{
     //typedef CGAL::Delaunay_triangulation_3<K,Tds> DelaunayTriangle;
     DelaunayTriangle::Facet  _facet = *_fIt;
     unsigned long _facetIndex = _facet.second;
 
     //typedef DelaunayTriangle::Cell_handle CGALCellHandle;
     CGALCellHandle facetCell = _facet.first;
     char _isInfiniteCell = _delaunayTriangule->is_infinite(_facetCell);
     //neighbor cell
     CGALCellHandle neigborCell = _cell->neighbor(_facetIndex );
     char _isInfiniteNeigbor = _delaunayTriangule.is_infinite(neigborCell);
 
     if( (!_isInfiniteCell) && (!isInfiniteNeigbor) )
     {
          //I only want the surface right?!?!!
          continue;
     } 
     char _iTriVrr=0;
    
     for(char _iPointsLoop=0;_iPointsLoop<4;_iPointsLoop++)
     {
           if( _iPointsLoop != _facetIndex )
           {
               *_iPointsIndexes[_iTriVrr++] = (unsigned long)(_fIt->first->vertex(_iPointsLoop)->info());
           }
     }
     //Here I got _indexA,_indexB,_indexC which I'm saving on the OBJ file.
 
    _fit++;
  
With this code, when I provide an ordinary box or even a sphere the result is just wonderful.
But when I try this with a small points cloud (10000 3d points of a tunnel for example) the result is a mess.
I got triangles coming from a side to the another and from the top to the ground.
I want just the surface.
 
I used this tunnel points cloud as example, but my intention is to use the same algorith providing points cloud of any
3d object or place  (e.g.: an office room).
 
Now I was about to try to integrate the my current source code with the CGAL "alpha shape" example...
 
But you've come with a different "light": "use a surface mesher". But a surface mesher wouldn't interpolate "new created points"?
So, to make this "surface mesher" what I've be doing so far is useless?
 
On the CGAL examples for surface mesher  (like examples/Surface_mesher/mesh_an_implicit_function.cpp)
the input points comes from a generator surface function 
 
// defining the surface
//  Surface_3 surface
 
Can I insert points of an unknown shape?
 
I really appreciate your help!
Thanks once again!
 
Juliano Costa
Brazil.
 
 
2009/8/5 Manuel Caroli <>
Hi Juliano,

the Triangulation_3 package computes a triangulation of R^3 with the input points as vertices. If you want to compute a triangular mesh approximating a surface you should use a surface mesher. Maybe you could be more specific about your problem.

best

Manuel




Archive powered by MHonArc 2.6.16.

Top of Page