Point set structuring with Cartesian_converter_property_map?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Point set structuring with Cartesian_converter_property_map?

Jing Zhao
This post was updated on .
Hi guys,

I'm using CGAL::Point_set_with_structure together with
CGAL::Cartesian_converter_property_map and the compiling process failed.

I'm using Exact_predicates_inexact_constructions_kernel with
Efficient_RANSAC to do plane detection first.
Then I want to send the plane detection result of RANSAC to
Point_set_structuring with Exact_predicates_exact_constructions_kernel.
(Since I need the projection result of structuring to be exact, the
exact_constructions_kernel is required here).
However the compiling process failed. It seems that the constructor of
Cartesian_converter_property_map needs 1 argument while the source code did
not consider this situation?

My code looks like this:

// Kernel type declarations
typedef CGAL::Exact_predicates_inexact_constructions_kernel    Kernel;
typedef CGAL::Exact_predicates_exact_constructions_kernel      
Exact_kernel;

// exact construction types
typedef Exact_kernel::Point_3                                                                  
epoint;
typedef Exact_kernel::Plane_3                                                                  
eplane;
typedef Exact_kernel::Vector_3                                                                
evector;

// inexact construction types
typedef Kernel::Point_3                                                                                 Point;
typedef Kernel::Plane_3                                                                                Plane;
typedef Kernel::Vector_3                                                                               Vector;
typedef std::pair<Point, Vector>                                                                    Point_with_normal;
typedef std::vector<Point_with_normal>                                                       Pwn_vector;
typedef CGAL::First_of_pair_property_map<Point_with_normal>                Point_map;
typedef CGAL::Second_of_pair_property_map<Point_with_normal>           Normal_map;

// Efficient RANSAC types
typedef CGAL::Shape_detection_3::Shape_detection_traits
  <Kernel, Pwn_vector, Point_map, Normal_map>                                        Traits;
typedef CGAL::Shape_detection_3::Efficient_RANSAC<Traits>                   Efficient_ransac;
typedef CGAL::Shape_detection_3::Plane<Traits>                                        Plane_shape;
typedef CGAL::Shape_detection_3::Plane_map<Traits>                               Plane_map;
typedef CGAL::Shape_detection_3::Point_to_shape_index_map<Traits>     Plane_index_map;

// property map converter
typedef CGAL::Cartesian_converter_property_map<epoint, Point_map>        IK_to_EK_point_map;
typedef CGAL::Cartesian_converter_property_map<evector, Normal_map>   IK_to_EK_normal_map;
typedef CGAL::Cartesian_converter_property_map<eplane, Plane_map>      IK_to_EK_plane_map;

// Structuring types
typedef CGAL::Point_set_with_structure<Exact_kernel>           Structure;

  // RANSAC Shape detection
  Efficient_ransac ransac;
  ransac.set_input(points);
  ransac.add_shape_factory<Plane_shape>();
  ransac.detect();

  Efficient_ransac::Plane_range planes = ransac.planes();
 
  // Points with normals.
  Pwn_vector points;

  // Point set structuring
  Structure pss (points,
                 planes,
                 0.015, // epsilon for structuring points
                 CGAL::parameters::point_map ( IK_to_EK_point_map(Point_map()) ).
                 normal_map ( IK_to_EK_normal_map(Normal_map()) ).
                 plane_map ( IK_to_EK_plane_map(Plane_map()) ).
                 plane_index_map ( CGAL::Shape_detection_3::Point_to_shape_index_map<Traits>(points, planes) )
  );


The compiling error message looks like this:

/usr/local/include/CGAL/structure_point_set.h:253:78: error: no matching function for call to ‘CGAL::Cartesian_converter_property_map<CGAL::Point_3<CGAL::Epeck>, CGAL::First_of_pair_property_map<std::pair<CGAL::Point_3<CGAL::Epick>, CGAL::Vector_3<CGAL::Epick> > > >::Cartesian_converter_property_map()’
     PointMap point_map = choose_param(get_param(np, internal_np::point_map), PointMap());
                                                                                                                                   ^~~~~~~~~~
In file included from /usr/local/include/CGAL/IO/read_xyz_points.h:27:0,
                 from structuring_example.cpp:3:
/usr/local/include/CGAL/property_map.h:550:3: note: candidate: CGAL::Cartesian_converter_property_map<GeomObject, Vpm>::Cartesian_converter_property_map(Vpm) [with GeomObject = CGAL::Point_3<CGAL::Epeck>; Vpm = CGAL::First_of_pair_property_map<std::pair<CGAL::Point_3<CGAL::Epick>, CGAL::Vector_3<CGAL::Epick> > >]
   Cartesian_converter_property_map(Vpm vpm):vpm(vpm){}
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/CGAL/property_map.h:550:3: note:   candidate expects 1 argument, 0 provided



From what I know, the constructor of Cartesian_converter_property_map needs one property map object as argument as I did in the above code (the
italic bold part). However the source code of structuring seems did not
allow this?


The source code looks like this:

 230   template <typename PointRange,
 231             typename PlaneRange,
 232             typename NamedParameters>
 233   void init (const PointRange& points,
 234              const PlaneRange& planes,
 235              double epsilon,
 236              const NamedParameters& np)
 237   {
 238     using boost::choose_param;
 239
 240     // basic geometric types
 241     typedef typename Point_set_processing_3::GetPointMap<PointRange, NamedParameters>::type PointMap;
 242     typedef typename Point_set_processing_3::GetNormalMap<PointRange, NamedParameters>::type NormalMap;
 243     typedef typename Point_set_processing_3::GetPlaneMap<PlaneRange, NamedParameters>::type PlaneMap;
 244     typedef typename Point_set_processing_3::GetPlaneIndexMap<NamedParameters>::type PlaneIndexMap;
 245
 246     CGAL_static_assertion_msg(!(boost::is_same<NormalMap,
 247                                 typename Point_set_processing_3::GetNormalMap<PointRange,
NamedParameters>::NoMap>::value),
 248                               "Error: no normal map");
 249     CGAL_static_assertion_msg(!(boost::is_same<PlaneIndexMap,
 250                                 typename Point_set_processing_3::GetPlaneIndexMap<NamedParameters>::NoMap>::value),
 251                               "Error: no plane index map");
 252
 253     PointMap point_map = choose_param(get_param(np, internal_np::point_map), PointMap());
 254     NormalMap normal_map = choose_param(get_param(np, internal_np::normal_map), NormalMap());
 255     PlaneMap plane_map = choose_param(get_param(np, internal_np::plane_map), PlaneMap());
 256     PlaneIndexMap index_map = choose_param(get_param(np, internal_np::plane_index_map), PlaneIndexMap());
 257     double attraction_factor = choose_param(get_param(np, internal_np::attraction_factor), 3.);

I'm really new to CGAL and not sure if what I think is right. Could someone
tell me what to do with this? Should I modify the source code?

Thanks in advance!

Best,
Jing




--
Sent from: http://cgal-discuss.949826.n4.nabble.com/

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