Subject: CGAL users discussion list
List archive
Re: [cgal-discuss] polyhedron with user defined extra information on the vertices
Chronological Thread
- From: Pádraig Ó Conbhuí <>
- To:
- Subject: Re: [cgal-discuss] polyhedron with user defined extra information on the vertices
- Date: Wed, 18 May 2016 11:53:26 +0100
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=Pass ; spf=None
- Ironport-phdr: 9a23:1RxhfRCenR/LD9a1aJjFUyQJP3N1i/DPJgcQr6AfoPdwSPj7pMbcNUDSrc9gkEXOFd2CrakU2qyN6+u6AiQp2tWojjMrSNR0TRgLiMEbzUQLIfWuLgnFFsPsdDEwB89YVVVorDmROElRH9viNRWJ+iXhpQAbFhi3DwdpPOO9QteU1JTmkbvqsMeIKyxzxxODIppKZC2sqgvQssREyaBDEY0WjiXzn31TZu5NznlpL1/A1zz158O34YIxu38I46FppIZ9V77ndfE4UaBAF2ZhdHsk4dXi8xjFVwqGoHUGFX4HlwJBRAnD4ha9VZj4tm72t/F2xTKBbvDwVq0+DDS+879wGlivkzYCLzd/8WfNi8U2grgcuwOkvxU4wojaZ8aeO/N6O6/cZtgHXnESY8BKSiYUAp+gd5BdSK0aLONAps/8oUEPpF2wH063Feb3w3hJgHHxmqY12uBkHQDd1xE7BIEytyHfo9zxcasTSuuo17LgzDPZbvoQ1y2uxpLPd0UZKP2WVLN/OXGZ4k4pHQPYCx3EsYvuODWf1vkMm2ee5utkE+mojjh0+ElKvjGzy5J02cHyjYUPxwWc+A==
Oh right, it works with std::map because it is "less than" comparable (ie the < operator works).
On Wed, May 18, 2016 at 11:44 AM, Andreas Fabri <> wrote:
It is in fact hashable, but the container then is not a std::map
but a boost::unordered_map
andreas
On 18/05/2016 12:39, Pádraig Ó Conbhuí wrote:
Hi Pratyush,
You can also use a std::map to store extra data, since Vertex_handle is
hashable. So something like
std::map<Polyhedron::Vertex_handle, double> my_values;
my_values[vertex_handle_i] = double_value;
could be the easiest solution, without having to play about with
changing the template parameters.
Cheers,
Paddy
On Wed, May 18, 2016 at 9:54 AM, Pratyush Pranav <<mailto:>> wrote:
Hi Sebastian,
Thanks for pointing out the relevant material.
Now, I try to write a basic code (a modification of one of the
examples to have colour on the faces of the tetrahedron from the
CGAL documentation), to be able to have some of my own items on the
vertices, and also have access to point() on the vertex (this is
what is giving me problems). Could you please help me with where I
am going wrong? Below is the code.
pratyush
————————————————————
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Polyhedron_3.h>
// A face type with a color member variable.
typedef CGAL::Simple_cartesian<double> Kernel;
template <class Refs, class Traits>
struct My_vertex : public CGAL::HalfedgeDS_vertex_base<Refs> {
typedef typename Traits::Point_3 Point;
double value;
long index;
};
// An items type using my face.
struct My_items : public CGAL::Polyhedron_items_3 {
template <class Refs, class Traits>
struct Vertex_wrapper {
typedef My_vertex<Refs,Traits> Vertex;
};
};
typedef Kernel::Point_3 Point_3;
typedef CGAL::Polyhedron_3<Kernel,My_items> Polyhedron;
typedef Polyhedron::Halfedge_handle Halfedge_handle;
typedef Polyhedron::Vertex_handle Vertex_handle;
int main() {
Point_3 p( 0.0, 0.0, 0.0);
Point_3 q( 1.0, 0.0, 0.0);
Point_3 r( 0.0, 1.0, 0.0);
Point_3 s( 0.0, 0.0, 1.0);
Polyhedron P;
P.make_tetrahedron(p,q,r,s);
Vertex_handle v = P.vertices_begin();
//v->value = 3.14;
v->index = 1;
std::cerr<<v->point()<<" "<<v->index<<std::endl;
return 0;
}
> On 17 May 2016, at 10:03, Sebastien Loriot (GeometryFactory)< <mailto:>> wrote:
>
> It is possible using a custom items traits (second template
parameter).
> The concept is documented here:
> http://doc.cgal.org/latest/Polyhedron/classPolyhedronItems__3.html
>
> For an example see how ids are added to simplices in
CGAL/Polyhedron_items_with_id_3.h
>
> Note that using the class Surface_mesh would allow you to do
property assignment at run-time.
>
> http://doc.cgal.org/latest/Surface_mesh/
>
>
> Best,
>
> Sebastien.
>
> On 05/15/2016 02:43 PM, Pratyush Pranav wrote:
>> Hi,
>>
>> I would like to know if it is possible to derive a polyhedron_3
in such a way that i can store a couple of extra information on the
vertices (specifically each vertex should have two additional
variables associated with it, one of a double type, and another one
of long or int type).
>>
>> any leads would be great! thanks in advance!
>>
>> pratyush
>>
>
>
> --
> You are currently subscribed to cgal-discuss.
> To unsubscribe or access the archives, go to
> https://sympa.inria.fr/sympa/info/cgal-discuss
>
>
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss
--
Andreas Fabri, PhD
Chief Officer, GeometryFactory
Editor, The CGAL Project
phone: +33.492.954.912 skype: andreas.fabri
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss
- [cgal-discuss] polyhedron with user defined extra information on the vertices, Pratyush Pranav, 05/15/2016
- Re: [cgal-discuss] polyhedron with user defined extra information on the vertices, Sebastien Loriot (GeometryFactory), 05/17/2016
- Re: [cgal-discuss] polyhedron with user defined extra information on the vertices, Pratyush Pranav, 05/18/2016
- Re: [cgal-discuss] polyhedron with user defined extra information on the vertices, Pádraig Ó Conbhuí, 05/18/2016
- Re: [cgal-discuss] polyhedron with user defined extra information on the vertices, Andreas Fabri, 05/18/2016
- Re: [cgal-discuss] polyhedron with user defined extra information on the vertices, Pádraig Ó Conbhuí, 05/18/2016
- Re: [cgal-discuss] polyhedron with user defined extra information on the vertices, Pratyush Pranav, 05/18/2016
- Re: [cgal-discuss] polyhedron with user defined extra information on the vertices, Pádraig Ó Conbhuí, 05/18/2016
- Re: [cgal-discuss] polyhedron with user defined extra information on the vertices, Andreas Fabri, 05/18/2016
- Re: [cgal-discuss] polyhedron with user defined extra information on the vertices, Sebastien Loriot (GeometryFactory), 05/18/2016
- Re: [cgal-discuss] polyhedron with user defined extra information on the vertices, Pratyush Pranav, 05/18/2016
- Re: [cgal-discuss] polyhedron with user defined extra information on the vertices, Pratyush Pranav, 05/18/2016
- Re: [cgal-discuss] polyhedron with user defined extra information on the vertices, Pratyush Pranav, 05/18/2016
- Re: [cgal-discuss] polyhedron with user defined extra information on the vertices, Pádraig Ó Conbhuí, 05/18/2016
- Re: [cgal-discuss] polyhedron with user defined extra information on the vertices, Pratyush Pranav, 05/18/2016
- Re: [cgal-discuss] polyhedron with user defined extra information on the vertices, Sebastien Loriot (GeometryFactory), 05/17/2016
Archive powered by MHonArc 2.6.18.