Subject: CGAL users discussion list
List archive
[cgal-discuss] Apollonius graph -- how to assign additional information to sites?
Chronological Thread
- From: Stefan Salewski <>
- To:
- Subject: [cgal-discuss] Apollonius graph -- how to assign additional information to sites?
- Date: Sun, 06 Oct 2013 17:11:32 +0200
I have a minimal test program for generating the convex hull of circles
inserted into the Apollonius graph, see below. Seems to work fine.
Before I write some bindings for Ruby language, one more question: It is
possible to associate some data to each site? For the Delaunay
triangulation there is
http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Triangulation_2/Chapter_main.html#Subsection_37.11.1
which shows for example how we can add color information to vertices.
Boost RTREE
http://www.boost.org/doc/libs/1_54_0/libs/geometry/doc/html/geometry/spatial_indexes/rtree_quickstart.html
uses something like std::pair<Box, MyGeometryId>. For the Apollonius
graph I do not see something similar. My first idea was to use a hash
map to map x, y coordinates of sites of the convex hull result to my
associated data structures (complex circular objects). I guess it may be
problematic due to rounding -- I may use two doubles to create a site
and as keys of my hash entry, but may get back a rounded double value
due to CGAL's intern exact arithmetic?
#include <iostream>
#include <CGAL/MP_Float.h>
typedef CGAL::MP_Float NT;
#include <CGAL/Simple_cartesian.h>
typedef CGAL::Simple_cartesian<NT> Kernel;
#include <CGAL/Apollonius_graph_2.h>
#include <CGAL/Apollonius_graph_traits_2.h>
typedef CGAL::Apollonius_graph_traits_2<Kernel> Traits;
typedef CGAL::Apollonius_graph_2<Traits> Apollonius_graph;
#include <CGAL/Apollonius_site_2.h>
typedef Apollonius_graph::Vertex_handle VH;
typedef Apollonius_graph::Site_2 Site;
typedef Site::Point_2 Point;
class AG : public Apollonius_graph
{
public:
int hash; // supported by Ruby hash
};
int main()
{
AG ag;
VH h;
Point p;
Site s;
p = Point(0, 0);
s = Site(p, 2);
h = ag.insert(s);
std::cout << h->site() << std::endl;
p = Point(0, 1);
s = Site(p, 2);
ag.insert(s);
p = Point(1, 0);
s = Site(p, 2);
ag.insert(s);
p = Point(1, 1);
s = Site(p, 2);
ag.insert(s);
p = Point(0.5, 0.5);
s = Site(p, 2);
ag.insert(s);
p = Point(0.1, 0.1);
s = Site(p, 2.2);
ag.insert(s);
Apollonius_graph::Vertex_circulator Cvert =
ag.incident_vertices(ag.infinite_vertex()); //take points incident to
infinte vertex
Apollonius_graph::Vertex_circulator Cvert0 = Cvert;
std::vector<Site> Vsite0;
do{
++Cvert;
std::cout << Cvert->site() << std::endl;
}while(Cvert0!=Cvert);
return 0;
}
- [cgal-discuss] Apollonius graph -- how to assign additional information to sites?, Stefan Salewski, 10/06/2013
- Re: [cgal-discuss] Apollonius graph -- how to assign additional information to sites?, Stefan Salewski, 10/06/2013
- Re: [cgal-discuss] Apollonius graph -- how to assign additional information to sites?, Sebastien Loriot (GeometryFactory), 10/07/2013
- Re: [cgal-discuss] Apollonius graph -- how to assign additional information to sites?, Stefan Salewski, 10/06/2013
Archive powered by MHonArc 2.6.18.