Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] error in using CGAL::grid_simplify_point_set

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] error in using CGAL::grid_simplify_point_set


Chronological Thread 
  • From: Nader SALMAN <>
  • To:
  • Subject: Re: [cgal-discuss] error in using CGAL::grid_simplify_point_set
  • Date: Tue, 08 Dec 2009 18:43:10 +0100

Hi Tina,

thank you for your interest in CGAl and for using the PSP package.

here is how you should do it in general :

// kernel
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;

// Simple geometric types
typedef Kernel::FT FT;
typedef Kernel::Point_3 Point;
typedef Kernel::Vector_3 Vector;


// Point with normal vector stored in a std::pair.
typedef std::pair<Point, Vector> PointVectorPair;
typedef std::vector<PointVectorPair> PointList;


CGAL::grid_simplify_point_set(points.begin(), points.end(),
                                               CGAL::First_of_pair_property_map<PointVectorPair>(),
                                               cell_size);



in your case it would be :

 // simplification by clustering using erase-remove idiom
  double cell_size = 0.001;

  points.erase(CGAL::grid_simplify_point_set(points.begin(), points.end(),                                CGAL::First_of_pair_property_map<PointVectorPair>(), cell_size), points.end());


  // Optional: after erase(), use Scott Meyer's "swap trick" to trim excess capacity
  std::vector<Point>(points).swap(points);

Hope this helped!

Cheers,
Nad.
Nader SALMAN
Geometrica Lab, Byron Y308
INRIA Sophia Antipolis (FRANCE)

Tel: +33(0)4 9238 7161   Fax: +33(0)4 9715 5395   


http://www-sop.inria.fr/members/Nader.Salman


tina rumi a écrit :
Hi all,

I am trying to use following function:

points.erase(CGAL::grid_simplify_point_set(points.begin(), points.end(), cell_size),
               points.end());



the type that I am using for points is :

// types
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef Kernel::Point_3 Point;
typedef Kernel::Vector_3 Vector;

// Point with normal vector stored in a std::pair.
typedef std::pair<Point, Vector> PointVectorPair;

std::list<PointVectorPair> points;

but it caused error. I want to keep this type for points. Do you have any suggestion to fix it.

Thank you,
Tina



Archive powered by MHonArc 2.6.16.

Top of Page