Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] How to use (Vertex) Handles in CGAL?

Subject: CGAL users discussion list

List archive

[cgal-discuss] How to use (Vertex) Handles in CGAL?


Chronological Thread 
  • From: Bagga <>
  • To:
  • Subject: [cgal-discuss] How to use (Vertex) Handles in CGAL?
  • Date: Wed, 7 Mar 2012 02:53:40 -0800 (PST)

Hello Guys,

I have many basic doubts:

*Q0: To use Dual of the Vornoi Diagram do I need to declare or include
Delaunay Graph typedef somewhere in the lines shown below or DT can be used
directly to declare DelaunayGraph?:*

// includes for defining the Voronoi diagram adaptor
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Delaunay_triangulation_2.h>
#include <CGAL/Voronoi_diagram_2.h>
#include <CGAL/Delaunay_triangulation_adaptation_traits_2.h>
#include <CGAL/Delaunay_triangulation_adaptation_policies_2.h>

// typedefs for defining the adaptor
typedef CGAL::Exact_predicates_inexact_constructions_kernel
K;
typedef CGAL::Delaunay_triangulation_2<K>
DT;
typedef CGAL::Delaunay_triangulation_adaptation_traits_2<DT>
AT;
typedef CGAL::Delaunay_triangulation_caching_degeneracy_removal_policy_2<DT>
AP;
typedef CGAL::Voronoi_diagram_2<DT,AT,AP>
VD;


*Q1: If I have a vornoi Diagram, how can I assign each site to a
Vertex_handle defined by me?*
For example:

typedef CGAL::Voronoi_diagram_2<DT,AT,AP>
VD;
VD vd;

std::ifstream ifs("data/data1.dt.cin");
assert( ifs );

Site_2 t;
while ( ifs >> t ) { vd.insert(t); }

for (Site_iterator si = vd.sites_begin(); si != vd.sites_end(); ++si) {
Vertex_handle vh = (Point_2) (*si); *//This doesn't
work*
do_something_with_this_vertex_handle_mentioned_in_next_question
}

* / Vertex_handle vh = (Point_2) (*si);/* This line is wrong and I
want to know how can I assign Vertex_handle to a vertex or site in the
Vornoi Diagram?


*Q2: Once we declared the Vertex_handle, I want to use DelaunayGraph to get
all the incident vertices on that vertex. I tried to do this:
*
/(Here I am assuming that DT can be used for Delaunay graph declarartion)/
*//Please correct me if I am wrong*

typedef CGAL::Delaunay_triangulation_2<K>
DT;
typedef DT

Delaunay_Graph;
typedef Delaunay_Graph::Vertex_circulator
VC;

Delaunay_Graph dg = vd.dual(); //it works but I am not sure if it is the
right of doing this.

Now what I want is to do this:
VC vc_start = dg.incident_vertices(v);

for (Site_iterator si = vd.sites_begin(); si != vd.sites_end(); ++si) {
Vertex_handle vh = (Point_2) (*si);
VC vc_start = dg.incident_vertices(vh);
}

And then I would like to access these incident vertices from this
Vertex_Circulator. /But this code is not working for me./
If you guys can help it will be great!

--
Thank you so much!

--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/How-to-use-Vertex-Handles-in-CGAL-tp4452870p4452870.html
Sent from the cgal-discuss mailing list archive at Nabble.com.


  • [cgal-discuss] How to use (Vertex) Handles in CGAL?, Bagga, 03/07/2012

Archive powered by MHonArc 2.6.16.

Top of Page