Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Delaunay with info segfault in spatial sort

Subject: CGAL users discussion list

List archive

[cgal-discuss] Delaunay with info segfault in spatial sort


Chronological Thread 
  • From: Dmitriy Morozov <>
  • To:
  • Subject: [cgal-discuss] Delaunay with info segfault in spatial sort
  • Date: Thu, 19 Dec 2013 13:57:38 -0800

Hi,

I'm trying to construct a Delaunay triangulation where each vertex stores its own index. I copied the example from the CGAL documentation, except I've increased the number of points from 6 to 10^6. The code (attached) segfaults with CGAL 4.3 during the spatial sort (I insert the range of points in the constructor). I can work around the problem by inserting points one by one, but that, of course, sacrifices efficiency.

Does anyone have any idea what's going on and whether I could somehow fix this?

Thanks.
Dmitriy
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Delaunay_triangulation_3.h>
#include <CGAL/Triangulation_vertex_base_with_info_3.h>
#include <vector>
typedef CGAL::Exact_predicates_inexact_constructions_kernel         K;
typedef CGAL::Triangulation_vertex_base_with_info_3<unsigned, K>    Vb;
typedef CGAL::Triangulation_data_structure_3<Vb>                    Tds;
//Use the Fast_location tag. Default or Compact_location works too.
//typedef CGAL::Delaunay_triangulation_3<K, Tds, CGAL::Fast_location> Delaunay;
typedef CGAL::Delaunay_triangulation_3<K, Tds>                      Delaunay;
typedef Delaunay::Point                                             Point;
int main()
{
  std::vector< std::pair<Point,unsigned> > points;
  for (unsigned i = 0; i < 1000000; ++i)
  {
    Point p(rand(), rand(), rand());
    points.push_back(std::make_pair(p, i));
  }

  Delaunay T( points.begin(),points.end() );
  CGAL_assertion( T.number_of_vertices() == points.size() );
  // check that the info was correctly set.
  Delaunay::Finite_vertices_iterator vit;
  for (vit = T.finite_vertices_begin(); vit != T.finite_vertices_end(); ++vit)
    if( points[ vit->info() ].first != vit->point() ){
      std::cerr << "Error different info" << std::endl;
      exit(EXIT_FAILURE);
    }
  std::cout << "OK" << std::endl;
  return 0;
}



Archive powered by MHonArc 2.6.18.

Top of Page