Subject: CGAL users discussion list
List archive
- From: Manuel Caroli <>
- To:
- Subject: Re: [cgal-discuss] Newbie question about CGAL Hierarchy Triangulation 3.
- Date: Wed, 05 Aug 2009 11:50:06 +0200
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
Juliano Costa wrote:
Thanks a lot for your attention Mariette,
Ok, so the source code I used gives me the 6 tetrhadra triangulation, is that right? But can I achieve this 5 tetrhadra triangulation using the CGAL library?
Can you give me a clue of the source code I need?
Do you think I should use the mesh algorithm instead of triangulation to achieve what I was expecting? Best regards,
Juliano Costa
Brazil.
2009/8/3 Mariette Yvinec < <mailto:>>
There are two ways to triangulate a cube,
using 5 or 6 tetrahedra.
Both ways yield Delaunay triangulations.
When using a 6 tetrhadra triangulation, you get
the diagonal of the cube in the triangulation.
Juliano Costa wrote:
Hello,
I'm researching CGAL for 3D Triangulations.
To do so I'm providing to the CGAL::Delaunay_triangulation_3, 8
points of a 3D Cube.
Then I ran an Edge iterator and I got a result which is one of the
diagonals of my cube.
I wasn't expecting to get this Edge.
If I run the finite_cells_iterator the result is even more strange
to me because, If I try to draw the cells
in the order they are given my cube doesn't look right.
What is the right way to draw the triangles? Using edges iterators?
It seems that I didn't understand Delaunay triangulations 3 right.
Of course I'm aware that CGAL result is correct, or maybe my
source code is wrong but, can someone please help me to understand it?
Is there any way to use CGAL library to get only the 12 triangles
from the cube surface (2 triangles per side of the cube)?
The code I've been compiling on VS2005 32bit is right below.
Thanks anyone in advance!
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Delaunay_triangulation_3.h>
#include <CGAL/Triangulation_vertex_base_with_info_3.h>
#include <conio.h>
struct K : CGAL::Exact_predicates_inexact_constructions_kernel {};
typedef CGAL::Triangulation_vertex_base_with_info_3<unsigned long,
K> Vb;
typedef CGAL::Triangulation_data_structure_3<Vb> Tds;
typedef CGAL::Delaunay_triangulation_3<K, Tds> Delaunay;
typedef Delaunay::Point Point;
typedef Delaunay::Vertex_handle Vertex_handle;
int main()
{
Delaunay T;
Vertex_handle vh;
vh = T.insert(Point(0,0,0));
vh->info() = 1; //attaching an index for each point from 1 to 8.
vh = T.insert(Point(1,0,0));
vh->info() = 2;
vh = T.insert(Point(0,0,1));
vh->info() = 3;
vh = T.insert(Point(1,0,1));
vh->info() = 4;
vh = T.insert(Point(0,1,0));
vh->info() = 5;
vh = T.insert(Point(1,1,0));
vh->info() = 6;
vh = T.insert(Point(0,1,1));
vh->info() = 7;
vh = T.insert(Point(1,1,1));
vh->info() = 8;
int ct=0;
std::cout<<std::endl<<"Finite_edges_iterator:"<<std::endl;
for(Delaunay::Finite_edges_iterator
eit=T.finite_edges_begin();eit!=T.finite_edges_end();eit++)
{
unsigned long i1 =eit->first->vertex(eit->second)->info();
unsigned long i2=eit->first->vertex(eit->third)->info();
std::cout<<" Edge: ("<<i1<<","<<i2<<")."<<std::endl;
}
ct=0;
std::cout<<std::endl<<"Finite_cells_iterator:"<<std::endl;
for(Delaunay::Finite_cells_iterator
fcit=T.finite_cells_begin();fcit!=T.finite_cells_end();fcit++)
{
std::cout<<"Cell "<<ct++<<":
"<<(fcit->vertex(0))->info()<<","<<(fcit->vertex(1))->info()<<","<<(fcit->vertex(2))->info()<<","<<(fcit->vertex(3))->info()<<std::endl;
}
std::cout<<"Type anything to close!";
_getch();
return 0;
}
The output /*(in reduced number of lines)*/ is:
Finite_edges_iterator:
Edge: (1,3). Edge: (1,5). Edge: (3,5). Edge: (2,1). Edge:
(2,3). Edge: (2,5). Edge: (6,8). Edge: (6,7).
Edge: (8,7). Edge: (8,4). Edge: (4,7). Edge: (2,4). Edge:
(4,3). Edge: (2,6). Edge: (4,6). Edge: (6,5).
Edge: (3,7). Edge: (2,7). Edge: (7,5).
//Edge 2,7 is a diagonal of my cube!!!!! Is that right for a
delaunay triangulation????
Finite_cells_iterator:
Cell 0: 2,1,3,5 Cell 1: 6,4,8,7 Cell 2: 3,4,2,7 Cell 3: 2,4,6,7
Cell 4: 2,7,6,5 Cell 5: 3,7,2,5
-- Mariette Yvinec
Geometrica project team
INRIA Sophia-Antipolis
- [cgal-discuss] Newbie question about CGAL Hierarchy Triangulation 3., Juliano Costa, 08/01/2009
- [cgal-discuss] Re: Newbie question about CGAL Hierarchy Triangulation 3., Juliano Costa, 08/02/2009
- Re: [cgal-discuss] Newbie question about CGAL Hierarchy Triangulation 3., Mariette Yvinec, 08/03/2009
- Re: [cgal-discuss] Newbie question about CGAL Hierarchy Triangulation 3., Juliano Costa, 08/03/2009
- Re: [cgal-discuss] Newbie question about CGAL Hierarchy Triangulation 3., Manuel Caroli, 08/05/2009
- Re: [cgal-discuss] Newbie question about CGAL Hierarchy Triangulation 3., Juliano Costa, 08/05/2009
- Re: [cgal-discuss] Newbie question about CGAL Hierarchy Triangulation 3., Manuel Caroli, 08/05/2009
- Re: [cgal-discuss] Newbie question about CGAL Hierarchy Triangulation 3., Juliano Costa, 08/05/2009
- Re: [cgal-discuss] Newbie question about CGAL Hierarchy Triangulation 3., Manuel Caroli, 08/05/2009
- Re: [cgal-discuss] Newbie question about CGAL Hierarchy Triangulation 3., Juliano Costa, 08/07/2009
- Re: [cgal-discuss] Newbie question about CGAL Hierarchy Triangulation 3., Manuel Caroli, 08/10/2009
- Re: [cgal-discuss] Newbie question about CGAL Hierarchy Triangulation 3., Juliano Costa, 08/05/2009
- Re: [cgal-discuss] Newbie question about CGAL Hierarchy Triangulation 3., Manuel Caroli, 08/05/2009
- Re: [cgal-discuss] Newbie question about CGAL Hierarchy Triangulation 3., Juliano Costa, 08/05/2009
- Re: [cgal-discuss] Newbie question about CGAL Hierarchy Triangulation 3., Manuel Caroli, 08/05/2009
- Re: [cgal-discuss] Newbie question about CGAL Hierarchy Triangulation 3., Juliano Costa, 08/03/2009
Archive powered by MHonArc 2.6.16.