Point Property map

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

Point Property map

Annie-Pier L.
Hi, I would like to create a pointPropertyMap for the
CGAL::segmentation_via_sdf_values function. How can I do it?

Cheer,
Annie-Pier





--
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


Reply | Threaded
Open this post in threaded view
|

Re: Point Property map

Sebastien Loriot (GeometryFactory)
A point property map is usually a map associating a point to a vertex.
All the default models of FaceGraph provided by CGAL do have a default
one and you don't need to provide one to the functions you call.
In case you want to have a custom point map you need to comply with
boost concepts:

https://www.boost.org/doc/libs/1_67_0/libs/property_map/doc/property_map.html

For the purpose of the exercise, let's say you want to write a
map for a Surface_mesh that is translating its points by a constant
vector. You would write something like that:


template <class Point, class Vector>
struct Translate_point_map
{
   typedef Point value_type;
   typedef Point reference;
   typedef boost::readable_property_map_tag category;
   typedef CGAL::Surface_mesh<Point>::Vertex_index key_type;

   Translate_point_map(const CGAL::Surface_mesh<Point>& sm,
                       const Vector& v)
     : sm(sm)
     , v(v)
   {}

   friend value_type get(const Translate_point_map& m, key_type k)
   {
     return m.sm.point(k)+v;
   }

   const Surface_mesh<Point> sm;
   Vector v;
};

A complete example is here:
https://gist.github.com/sloriot/7093e7e4a77a494f0df8b3389f09e8f7

You might also want to read about properties that you can attach
to a surface mesh object:

https://doc.cgal.org/latest/Surface_mesh/#title6



Sebastien.

On 07/06/2018 08:21 PM, Annie-Pier L. wrote:

> Hi, I would like to create a pointPropertyMap for the
> CGAL::segmentation_via_sdf_values function. How can I do it?
>
> Cheer,
> Annie-Pier
>
>
>
>
>
> --
> 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


Reply | Threaded
Open this post in threaded view
|

Re: Point Property map

Annie-Pier L.
Thank you for your help!

I try this code :

//create a property-map for vertex-ids
  typedef std::map<Polyhedron::Vertex_const_handle, boost::vertex_point_t>
Vertex_int_map;
  Vertex_int_map internal_vertex_map;
  boost::associative_property_map<Vertex_int_map>
vertex_property_map(internal_vertex_map);

// create traits
  typedef typename boost::property_traits<Vertex_int_map>::value_type
Point_3;
  typedef typename Kernel_traits<Point_3>::Kernel GeomTraits;
  GeomTraits traits;

//Segmentation function
CGAL::segmentation_via_sdf_values(*mesh, segment_property_map,cone_angle,
  number_of_rays, number_of_clusters, smoothing_lambda,output_cluster_ids,
vertex_property_map, traits);


But I had this error:

boost::vertex_point_t> >’ does not name a type typedef typename
boost::property_traits<Vertex_int_map>::value_type Point_3;



--
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