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:39:06 +0100
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=Pass ; spf=None
- Ironport-phdr: 9a23:MGfwoxwfXNxPd2nXCy+O+j09IxM/srCxBDY+r6Qd0O8WIJqq85mqBkHD//Il1AaPBtWKrakcwLCN+4nbGkU+or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6anHS+4HYoFwnlMkItf6KuSt+U1Jz8jbv60qaQSjsLrQL1Wal1IhSyoFeZnegtqqwmFJwMzADUqGBDYeVcyDAgD1uSmxHh+pX4p8Y7oGwD888n7NNKBKXmY7wjH/sfFyUjK2lz5cvxtBCFQxHI/WoZSmxRkxxGBE/O4xj+G5vwqSDnrfEu5S+BIMejTawoQS/wqOBwWRrwgWEGMSQ4+SfZkItrnadDqVWgoRJ4hIXbaYXQOPtldb7GZoAmQj9KUc9VEiBAGYihdJAnDuwbPO8eoZOuiUEJqE6GjAW2DeLggoQArXjw160nVqx1CQbN2woqH88PmHvRpdTxcqwVVLbmn+Hz0TzfYqYOin/G44/Sf0V5rA==
Hi Pratyush,
You can also use a std::map to store extra data, since Vertex_handle is hashable. So something likeOn Wed, May 18, 2016 at 9:54 AM, Pratyush Pranav <> 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) <> 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
- [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.