Subject: CGAL users discussion list
List archive
Re: Re: [cgal-discuss]Attach user data to the vertices of aArrangement_2during construction
Chronological Thread
- From: "Wang Weiwei" <>
- To: "" <>
- Subject: Re: Re: [cgal-discuss]Attach user data to the vertices of aArrangement_2during construction
- Date: Sat, 31 Mar 2007 17:45:34 +0800
- Disposition-notification-to: "Wang Weiwei" <>
Thanks again for your help, Fogel.
In fact, I have finished my program in a way that I think is fairly ugly.
I'm just finding an elegant way to do the same thing.
B/Rgds
Max
>You can use your own observer (derived from
>CGAL::Arr_observer<Arrangement_2>). Look at face_extension.cpp to see
>how it's done for faces.
>
>Hello Fogel,
>
>Thanks very much for your hints.
>
>Yes, I found the example in ex_face_extension.C. But my needs seems not to
>be
>fully met. To declare a class derived from
>CGAL::Arr_observer<Arrangement_2>,
>and then override the before_create_vertex() method, I can capture the event
>of the insertion of a new vertex. But still one problem is that there's only
>a
>Arr_face_extended_dcel type in CGAL, no Arr_vertex_extended_dcel available.
>I
>
>
Read the Arrangement_2 manual. You can extend the Vertex, Halfedge, and
Face types in a similar way. Also, there is Arr_extended_dcel.h, which
you may find convenient.
>cannot associate data with the vertices as this way. The other problem is
>that
>the way I'm constructing the arrangement is like this:
>
>
Regarding this problem if I understand it right, you have at least two
options. You can create a map that maps points to data. When a vertex is
created, find the data of the corresponding point, and store it in the
vertex. Or, you can derive a new Kernel::Point_2. This requires some
knowledge, which you will have to look for at the Kernel manual (Look
for Extensible Kernel).
> typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
> typedef CGAL::Arr_segment_traits_2<Kernel>
> Traits_2;
> typedef Traits_2::Point_2
> Point_2;
> typedef Traits_2::X_monotone_curve_2
> Segment_2;
> typedef CGAL::Arr_extended_dcel<Traits_2, int, int, int>Dcel;
> typedef CGAL::Arrangement_2<Traits_2, Dcel>
> Arrangement_2;
>
> struct Point_2_with_id
> {
> int id;
> float x, y;
> };
>
> std::vector<Point_2_with_id> points;
> std::list<Segment_2> segments;
>
> for(std::vector<Point_2_with_id>::const_iterator it=points.begin();
> it != points.end(); ++it)
> {
> segments.push_back (
> Segment_2 ( Point_2( it->x, it->y ), Point_2( /*some
> other point*/ ) )
> );
> }
>
>The user data (here means the id of a point) was discarded during
>cunstructing
>a segment.
>
>I think it would be better if I can derive a class from Point_2, and if I
>can build the arrangement with the derive points.
>
>Thanks again.
>
>Max
>
>
>Wang Weiwei wrote:
>
>
>
>>Hi all,
>>
>>I'm using the Arrangement_2 module of CGAL.
>>
>>I want to attach some user information to the vertices of the arrangement.
>>I've found some example code in the example folder of the CGAL lib (such as
>>ex_dcel_extension.C).
>>
>>Unfortunately, in this example, the user data are attached to the vertices,
>>halfedges and faces after the arrangement was built. What I want to know is
>>how I can attach these user data to the vertices during the construction of
>>the arrangement. For those vertices newly created during the intersection
>>of
>>the curves, a pre-specified default value will be ok.
>>
>>Thanks in advance for any help.
>>
>>Sorry for the previous message with the subject not correct.
>>
>>Max
>>
>>
>>
>>
--
____ _ ____ _
/_____/_) o /__________ __ //
(____ ( ( ( (_/ (_/-(-'_(/
_/
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss
- voronoi of the vertices, tinavath, 03/20/2007
- <Possible follow-up(s)>
- voronoi of the vertices, tinavath, 03/27/2007
- Re: [cgal-discuss] voronoi of the vertices, Wang Weiwei, 03/28/2007
- [cgal-discuss]Attach user data to the vertices of a Arrangement_2 during construction, Wang Weiwei, 03/28/2007
- Re: [cgal-discuss]Attach user data to the vertices of a Arrangement_2 during construction, Efi Fogel, 03/30/2007
- Re: Re: [cgal-discuss]Attach user data to the vertices of a Arrangement_2during construction, Wang Weiwei, 03/30/2007
- Re: [cgal-discuss]Attach user data to the vertices of a Arrangement_2during construction, Efi Fogel, 03/30/2007
- Re: Re: [cgal-discuss]Attach user data to the vertices of aArrangement_2during construction, Wang Weiwei, 03/31/2007
- Re: [cgal-discuss]Attach user data to the vertices of a Arrangement_2during construction, Efi Fogel, 03/30/2007
- Re: Re: [cgal-discuss]Attach user data to the vertices of a Arrangement_2during construction, Wang Weiwei, 03/30/2007
- Re: [cgal-discuss]Attach user data to the vertices of a Arrangement_2 during construction, Efi Fogel, 03/30/2007
Archive powered by MHonArc 2.6.16.