Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Re: Extracting Information to Simple Array Format, Triangulation connectivity

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Re: Extracting Information to Simple Array Format, Triangulation connectivity


Chronological Thread 
  • From: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] Re: Extracting Information to Simple Array Format, Triangulation connectivity
  • Date: Tue, 03 Aug 2010 10:13:33 +0200

htg20 wrote:
Dear Sebastien,

Thank you. I followed what you recommended and worked(below) :-).
Great.

I just wish, there was a nicer way to do this. Since in the manual it says,
inserting points one by one is slow. Anyways, for now it does what I want
and I'm happy with it.

It's a issue we are working, I already gave a way to do it on this list
but it's not really nice. If this is really the bottleneck of your
program then we may try it and improve it.

https://lists-sop.inria.fr/sympa/arc/cgal-discuss/2010-01/msg00004.html

S.



Cheers
Hossein




#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Delaunay_triangulation_3.h>
#include <CGAL/Triangulation_vertex_base_with_info_3.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::Cell_iterator Cell_iterator;
typedef Delaunay::Vertex_handle Vertex_handle;
int main()
{
Delaunay T;
Vertex_handle vh, vh1,vh2,vh3,vh0;
vh = T.insert(Point(-1,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(-1,0,1));
vh->info() = 3;
vh = T.insert(Point(1,0,1));
vh->info() = 4;
vh = T.insert(Point(-1,1,0));
vh->info() = 5;
vh = T.insert(Point(1,1,0));
vh->info() = 6;
vh = T.insert(Point(-1,1,1));
vh->info() = 7;
vh = T.insert(Point(1,1,1));
vh->info() = 8;

for ( Cell_iterator cellIt=T.cells_begin(); cellIt!=T.cells_end();
cellIt++)
{

vh0= cellIt-> vertex(0);
vh1= cellIt-> vertex(1);
vh2= cellIt-> vertex(2);
vh3= cellIt-> vertex(3);
std::cout<< *cellIt << vh0 ->info() << vh1 ->info() << vh2
->info() <<
vh3 ->info() << std::endl;

}

std::cout << "Number of cells=" << T.number_of_cells() << "\n";
return 0;
}





Archive powered by MHonArc 2.6.16.

Top of Page