Converting Tetgen triangulation to CGAL

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Converting Tetgen triangulation to CGAL

tholzmann
Hi all,

I created a constrained Delaunay triangulation in 3D with Tetgen and want to convert it now to a CGAL triangulation. As it is no Delaunay triangulation anymore, I try to create an unrestricted CGAL::Triangulation_3<CGAL::Exact_predicates_inexact_constructions_kernel,CGAL::Triangulation_data_structure_3<Vbh, Cb> > wit the data from the CDT.

When I use the "normal" insert function to incrementally create the triangulation, I cannot directly influence the structure of the triangulation and therefore, as I want to keep the structure, this is not an option for me (am I right?).

So I tried to directly add the vertices and cells in the TDS using:

v1 = cgalTriangulation.tds().create_vertex(cgal_pt);
...
cell = cgalTriangulation.tds().create_cell(v1, v2, v3, v4);

However, it seems as if the cells are not added.

Here are the statistics of the triangulation after adding the data:

number_of_vertices() = 253792

number_of_finite_facets () = 0

number_of_finite_cells () = 0


cgalTriangulation.is_valid(true) says:
valid data structure
valid triangulation

Do I also need to set the cell neighbors and/or facets? Or am I completely wrong with my approach?

Any help would be appreciated!

Thomas
-- 
====================================================
Dipl.-Ing. Thomas Holzmann
TU Graz - Institut fuer Maschinelles Sehen und Darstellen
Graz University of Technology - Institute for Computer Graphics & Vision
Inffeldgasse 16/II, 8010 Graz, Austria

http://www.icg.tugraz.at/
phone: +43 316 873 5091
==================================================== 
Reply | Threaded
Open this post in threaded view
|

Re: Converting Tetgen triangulation to CGAL

andreas.fabri
Not only you are responsible for the neighbor, but CGAL has
also the infinite cells, incident to the infinite vertex,
in case tetgen has no infinite vertex.

andreas


On 29/11/2016 17:23, Thomas Holzmann wrote:

> Hi all,
>
> I created a constrained Delaunay triangulation in 3D with Tetgen and
> want to convert it now to a CGAL triangulation. As it is no Delaunay
> triangulation anymore, I try to create an unrestricted
> CGAL::Triangulation_3<CGAL::Exact_predicates_inexact_constructions_kernel,CGAL::Triangulation_data_structure_3<Vbh,
> Cb> > wit the data from the CDT.
>
> When I use the "normal" insert function to incrementally create the
> triangulation, I cannot directly influence the structure of the
> triangulation and therefore, as I want to keep the structure, this is
> not an option for me (am I right?).
>
> So I tried to directly add the vertices and cells in the TDS using:
>
> v1 = cgalTriangulation.tds().create_vertex(cgal_pt);
> ...
> cell = cgalTriangulation.tds().create_cell(v1, v2, v3, v4);
>
> However, it seems as if the cells are not added.
>
> Here are the statistics of the triangulation after adding the data:
>
> number_of_vertices() = 253792
>
> number_of_finite_facets () = 0
>
> number_of_finite_cells () = 0
>
>
> cgalTriangulation.is_valid(true) says:
> valid data structure
> valid triangulation
>
> Do I also need to set the cell neighbors and/or facets? Or am I
> completely wrong with my approach?
>
> Any help would be appreciated!
>
> Thomas
>
> --
> ====================================================
> Dipl.-Ing. Thomas Holzmann
> TU Graz - Institut fuer Maschinelles Sehen und Darstellen
> Graz University of Technology - Institute for Computer Graphics & Vision
> Inffeldgasse 16/II, 8010 Graz, Austria
>
> http://www.icg.tugraz.at/
> phone: +43 316 873 5091
> ====================================================
>

--
Andreas Fabri, PhD
Chief Officer, GeometryFactory
Editor, The CGAL Project

phone: +33.492.954.912    skype: andreas.fabri

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: Converting Tetgen triangulation to CGAL

tholzmann
So if I additionally add the cell neighbors and the infinite cells, it
should work like I did it?

Thanks!

Thomas


On 11/29/2016 05:26 PM, Andreas Fabri wrote:

> Not only you are responsible for the neighbor, but CGAL has
> also the infinite cells, incident to the infinite vertex,
> in case tetgen has no infinite vertex.
>
> andreas
>
>
> On 29/11/2016 17:23, Thomas Holzmann wrote:
>> Hi all,
>>
>> I created a constrained Delaunay triangulation in 3D with Tetgen and
>> want to convert it now to a CGAL triangulation. As it is no Delaunay
>> triangulation anymore, I try to create an unrestricted
>> CGAL::Triangulation_3<CGAL::Exact_predicates_inexact_constructions_kernel,CGAL::Triangulation_data_structure_3<Vbh,
>>
>> Cb> > wit the data from the CDT.
>>
>> When I use the "normal" insert function to incrementally create the
>> triangulation, I cannot directly influence the structure of the
>> triangulation and therefore, as I want to keep the structure, this is
>> not an option for me (am I right?).
>>
>> So I tried to directly add the vertices and cells in the TDS using:
>>
>> v1 = cgalTriangulation.tds().create_vertex(cgal_pt);
>> ...
>> cell = cgalTriangulation.tds().create_cell(v1, v2, v3, v4);
>>
>> However, it seems as if the cells are not added.
>>
>> Here are the statistics of the triangulation after adding the data:
>>
>> number_of_vertices() = 253792
>>
>> number_of_finite_facets () = 0
>>
>> number_of_finite_cells () = 0
>>
>>
>> cgalTriangulation.is_valid(true) says:
>> valid data structure
>> valid triangulation
>>
>> Do I also need to set the cell neighbors and/or facets? Or am I
>> completely wrong with my approach?
>>
>> Any help would be appreciated!
>>
>> Thomas
>>
>> --
>> ====================================================
>> Dipl.-Ing. Thomas Holzmann
>> TU Graz - Institut fuer Maschinelles Sehen und Darstellen
>> Graz University of Technology - Institute for Computer Graphics & Vision
>> Inffeldgasse 16/II, 8010 Graz, Austria
>>
>> http://www.icg.tugraz.at/
>> phone: +43 316 873 5091
>> ====================================================
>>
>

--
====================================================
Dipl.-Ing. Thomas Holzmann
TU Graz - Institut fuer Maschinelles Sehen und Darstellen
Graz University of Technology - Institute for Computer Graphics & Vision
Inffeldgasse 16/II, 8010 Graz, Austria

http://www.icg.tugraz.at/
phone: +43 316 873 5091
====================================================


--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: Converting Tetgen triangulation to CGAL

andreas.fabri

Hello,

On 30/11/2016 08:16, Thomas Holzmann wrote:
> So if I additionally add the cell neighbors and the infinite cells, it
> should work like I did it?

Does tetgen produce a tetrahedrization of the convex hull of the points?
The infinite cells are outside of the convex hull.

You probably also have to set the cell incident to each vertex.

best,

andreas

>
> Thanks!
>
> Thomas
>
>
> On 11/29/2016 05:26 PM, Andreas Fabri wrote:
>> Not only you are responsible for the neighbor, but CGAL has
>> also the infinite cells, incident to the infinite vertex,
>> in case tetgen has no infinite vertex.
>>
>> andreas
>>
>>
>> On 29/11/2016 17:23, Thomas Holzmann wrote:
>>> Hi all,
>>>
>>> I created a constrained Delaunay triangulation in 3D with Tetgen and
>>> want to convert it now to a CGAL triangulation. As it is no Delaunay
>>> triangulation anymore, I try to create an unrestricted
>>> CGAL::Triangulation_3<CGAL::Exact_predicates_inexact_constructions_kernel,CGAL::Triangulation_data_structure_3<Vbh,
>>>
>>> Cb> > wit the data from the CDT.
>>>
>>> When I use the "normal" insert function to incrementally create the
>>> triangulation, I cannot directly influence the structure of the
>>> triangulation and therefore, as I want to keep the structure, this is
>>> not an option for me (am I right?).
>>>
>>> So I tried to directly add the vertices and cells in the TDS using:
>>>
>>> v1 = cgalTriangulation.tds().create_vertex(cgal_pt);
>>> ...
>>> cell = cgalTriangulation.tds().create_cell(v1, v2, v3, v4);
>>>
>>> However, it seems as if the cells are not added.
>>>
>>> Here are the statistics of the triangulation after adding the data:
>>>
>>> number_of_vertices() = 253792
>>>
>>> number_of_finite_facets () = 0
>>>
>>> number_of_finite_cells () = 0
>>>
>>>
>>> cgalTriangulation.is_valid(true) says:
>>> valid data structure
>>> valid triangulation
>>>
>>> Do I also need to set the cell neighbors and/or facets? Or am I
>>> completely wrong with my approach?
>>>
>>> Any help would be appreciated!
>>>
>>> Thomas
>>>
>>> --
>>> ====================================================
>>> Dipl.-Ing. Thomas Holzmann
>>> TU Graz - Institut fuer Maschinelles Sehen und Darstellen
>>> Graz University of Technology - Institute for Computer Graphics & Vision
>>> Inffeldgasse 16/II, 8010 Graz, Austria
>>>
>>> http://www.icg.tugraz.at/
>>> phone: +43 316 873 5091
>>> ====================================================
>>>
>>
>

--
Andreas Fabri, PhD
Chief Officer, GeometryFactory
Editor, The CGAL Project

phone: +33.492.954.912    skype: andreas.fabri

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: Converting Tetgen triangulation to CGAL

tholzmann


On 11/30/2016 08:19 AM, Andreas Fabri wrote:
>
> On 30/11/2016 08:16, Thomas Holzmann wrote:
>> So if I additionally add the cell neighbors and the infinite cells, it
>> should work like I did it?
>
> Does tetgen produce a tetrahedrization of the convex hull of the points?
> The infinite cells are outside of the convex hull.
Yes, it produces a tetrahedrization of the convex hull. So I will also
create infinite cells and add it with their neighbors.
>
> You probably also have to set the cell incident to each vertex.
>
Ok, I'll do that.

I'll let you know if it worked.

Thanks!

Thomas

--
====================================================
Dipl.-Ing. Thomas Holzmann
TU Graz - Institut fuer Maschinelles Sehen und Darstellen
Graz University of Technology - Institute for Computer Graphics & Vision
Inffeldgasse 16/II, 8010 Graz, Austria

http://www.icg.tugraz.at/
phone: +43 316 873 5091
====================================================


--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: Converting Tetgen triangulation to CGAL

tholzmann

Hi,

So I now also created infinite cells, set all neighbors correctly (index on the opposite side of vertex index) and set an incident cell for each vertex (an arbitrary cell including this vertex).

However, i still have the same result:

number_of_finite_cells () = 0

and cgalTriangulation.is_valid(true) says:
valid data structure
valid triangulation

Any other advice? Or some hints how I could debug the problem?

Thomas


On 11/30/2016 09:06 AM, Thomas Holzmann wrote:


On 11/30/2016 08:19 AM, Andreas Fabri wrote:

On 30/11/2016 08:16, Thomas Holzmann wrote:
So if I additionally add the cell neighbors and the infinite cells, it
should work like I did it?

Does tetgen produce a tetrahedrization of the convex hull of the points?
The infinite cells are outside of the convex hull.
Yes, it produces a tetrahedrization of the convex hull. So I will also create infinite cells and add it with their neighbors.

You probably also have to set the cell incident to each vertex.

Ok, I'll do that.

I'll let you know if it worked.

Thanks!

Thomas


-- 
====================================================
Dipl.-Ing. Thomas Holzmann
TU Graz - Institut fuer Maschinelles Sehen und Darstellen
Graz University of Technology - Institute for Computer Graphics & Vision
Inffeldgasse 16/II, 8010 Graz, Austria

http://www.icg.tugraz.at/
phone: +43 316 873 5091
==================================================== 
Reply | Threaded
Open this post in threaded view
|

Re: Converting Tetgen triangulation to CGAL

teillaud
Administrator
Hi,

Maybe read the code of the input stream operator in Triangulation_3.h and check what you have missed. 

best,
--
Monique Teillaud 
https://members.loria.fr/Monique.Teillaud/
INRIA Nancy - Grand Est, LORIA 
Institut National de Recherche en Informatique et Automatique 

On 01 Dec 2016, at 10:54, Thomas Holzmann <[hidden email]> wrote:

Hi,

So I now also created infinite cells, set all neighbors correctly (index on the opposite side of vertex index) and set an incident cell for each vertex (an arbitrary cell including this vertex).

However, i still have the same result:

number_of_finite_cells () = 0

and cgalTriangulation.is_valid(true) says:
valid data structure
valid triangulation

Any other advice? Or some hints how I could debug the problem?

Thomas


On 11/30/2016 09:06 AM, Thomas Holzmann wrote:


On 11/30/2016 08:19 AM, Andreas Fabri wrote:

On 30/11/2016 08:16, Thomas Holzmann wrote:
So if I additionally add the cell neighbors and the infinite cells, it
should work like I did it?

Does tetgen produce a tetrahedrization of the convex hull of the points?
The infinite cells are outside of the convex hull.
Yes, it produces a tetrahedrization of the convex hull. So I will also create infinite cells and add it with their neighbors.

You probably also have to set the cell incident to each vertex.

Ok, I'll do that.

I'll let you know if it worked.

Thanks!

Thomas


-- 
====================================================
Dipl.-Ing. Thomas Holzmann
TU Graz - Institut fuer Maschinelles Sehen und Darstellen
Graz University of Technology - Institute for Computer Graphics & Vision
Inffeldgasse 16/II, 8010 Graz, Austria

http://www.icg.tugraz.at/
phone: +43 316 873 5091
==================================================== 

Reply | Threaded
Open this post in threaded view
|

Re: Converting Tetgen triangulation to CGAL

tholzmann

Thanks, the conversion is working now.

Thomas


On 12/08/2016 09:51 AM, Monique Teillaud wrote:
Hi,

Maybe read the code of the input stream operator in Triangulation_3.h and check what you have missed. 

best,
--
Monique Teillaud 
https://members.loria.fr/Monique.Teillaud/
INRIA Nancy - Grand Est, LORIA 
Institut National de Recherche en Informatique et Automatique 

On 01 Dec 2016, at 10:54, Thomas Holzmann <[hidden email]> wrote:

Hi,

So I now also created infinite cells, set all neighbors correctly (index on the opposite side of vertex index) and set an incident cell for each vertex (an arbitrary cell including this vertex).

However, i still have the same result:

number_of_finite_cells () = 0

and cgalTriangulation.is_valid(true) says:
valid data structure
valid triangulation

Any other advice? Or some hints how I could debug the problem?

Thomas


On 11/30/2016 09:06 AM, Thomas Holzmann wrote:


On 11/30/2016 08:19 AM, Andreas Fabri wrote:

On 30/11/2016 08:16, Thomas Holzmann wrote:
So if I additionally add the cell neighbors and the infinite cells, it
should work like I did it?

Does tetgen produce a tetrahedrization of the convex hull of the points?
The infinite cells are outside of the convex hull.
Yes, it produces a tetrahedrization of the convex hull. So I will also create infinite cells and add it with their neighbors.

You probably also have to set the cell incident to each vertex.

Ok, I'll do that.

I'll let you know if it worked.

Thanks!

Thomas


-- 
====================================================
Dipl.-Ing. Thomas Holzmann
TU Graz - Institut fuer Maschinelles Sehen und Darstellen
Graz University of Technology - Institute for Computer Graphics & Vision
Inffeldgasse 16/II, 8010 Graz, Austria

http://www.icg.tugraz.at/
phone: +43 316 873 5091
==================================================== 


-- 
====================================================
Dipl.-Ing. Thomas Holzmann
TU Graz - Institut fuer Maschinelles Sehen und Darstellen
Graz University of Technology - Institute for Computer Graphics & Vision
Inffeldgasse 16/II, 8010 Graz, Austria

http://www.icg.tugraz.at/
phone: +43 316 873 5091
====================================================