Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] polyhedron with user defined extra information on the vertices

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] polyhedron with user defined extra information on the vertices


Chronological Thread 
  • From: Pratyush Pranav <>
  • To:
  • Subject: Re: [cgal-discuss] polyhedron with user defined extra information on the vertices
  • Date: Wed, 18 May 2016 19:40:57 +0200
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=Pass ; spf=None
  • Ironport-phdr: 9a23:FwipzBBuw/2Bn6WVS9kUUyQJP3N1i/DPJgcQr6AfoPdwSP//rsbcNUDSrc9gkEXOFd2CrakU2qyN6+u5ATxIyK3CmU5BWaQEbwUCh8QSkl5oK+++Imq/EsTXaTcnFt9JTl5v8iLzG0FUHMHjew+a+SXqvnYsExnyfTB4Ov7yUtaLyZ/nhqbpo9aKO1UArQH+SI0xBS3+lR/WuMgSjNkqAYcK4TyNnEF1ff9Lz3hjP1OZkkW0zM6x+Jl+73YY4Kp5pIYTGZj8ZLkyGLxEECw9YSdy/9zurRCFTA2V53JaXH9RiQtNGwGC7Rf0WdD6vSL+8+Z8wyKHJtalcLYvRD7377t3UAS6z2AcJjsh+SfWjNZxheRVulW6thlnysnVZo+Sc/Fxd6eYcdIBTndaRZVtUHlKDYq4KocOFOEcJv1wro/nplJIowHtKxOrAbbX0DZUl2Lt3eUCye0nGB+OiBQ6Fs4frWbZhNrwPaYWF+uyyf+bnn34c/pK1GKlu8DzeRc7rKTUUA==

Dear Sebastian, dear all,

I must thank you again. With your help, I managed to reduce my code from
O(N^2) to O(N).

Something that would have been running in the order of months now runs in the
order of minutes.

thanks again,

Pratyush


> On 18 May 2016, at 14:20, Sebastien Loriot (GeometryFactory)
> <>
> wrote:
>
> Your vertex class is missing a point data member.
>
> template <class Refs, class Traits>
> struct My_vertex :
> public CGAL::HalfedgeDS_vertex_base<Refs, CGAL::Tag_true, typename
> Traits::Point_3> {
> typedef typename Traits::Point_3 Point;
> typedef CGAL::HalfedgeDS_vertex_base<Refs, CGAL::Tag_true, Point> Base;
> double value;
> long index;
> My_vertex() : Base(){}
> My_vertex(const Point& p) : Base(p) {}
> };
>
> Sebastien.
>
> On 05/18/2016 10: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
>
>




Archive powered by MHonArc 2.6.18.

Top of Page