Subject: CGAL users discussion list
List archive
- From: Ben Strasser <>
- To: <>
- Subject: [cgal-discuss] Voronoi diagram - Could some one explain me this output?
- Date: Sat, 02 Jan 2010 01:28:03 +0100
Hello,
I'm trying to iterator over the boundaries of the facets of a Voronoi
diagram and have run into a CGAL behavior I can not explain. I build the
diagram of the points (1, 1), (-1, 1), (-1, -1) and (1, -1). Then I just
print out what objects CGAL gives me.
seg:-0 -0 -0 -0
ray:-0 -0 4 -0
ray:-0 -0 -0 4
---
ray:-0 -0 -4 -0
ray:-0 -0 -0 4
---
ray:-0 -0 -0 -4
seg:-0 -0 -0 -0
ray:-0 -0 -4 -0
---
ray:-0 -0 -0 -4
ray:-0 -0 4 -0
---
The rays are correct as each of the 4 facets is delimited by 2 rays.
However what is a segment starting at the origin and ending at the origin
supposed to mean. Did I run into a bug? Can anyone reproduce this?
My compiler: gcc version 4.4.1 (Ubuntu 4.4.1-4ubuntu8)
CGAL version:
#define CGAL_VERSION 3.4
#define CGAL_VERSION_NR 1030401000
#define CGAL_SVN_REVISION 47779
(that's the current ubuntu package)
Below is a minimal example that produces the output above.
thanks for your time,
Ben Strasser
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Delaunay_triangulation_2.h>
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
typedef CGAL::Segment_2<Kernel> Segment;
typedef CGAL::Ray_2<Kernel> Ray;
typedef CGAL::Point_2<Kernel> Point;
typedef CGAL::Line_2<Kernel> Line;
typedef CGAL::Delaunay_triangulation_2<Kernel> Triangulation;
#include<cassert>
#include<iostream>
using std::cout;
using std::endl;
int main(){
Point voronoi[] = {Point(1, 1), Point(-1, 1), Point(-1, -1), Point(1,
-1)};
Triangulation t;
t.insert(voronoi[0]);
t.insert(voronoi[1]);
t.insert(voronoi[2]);
t.insert(voronoi[3]);
for(Triangulation::Finite_vertices_iterator
i=t.finite_vertices_begin(),
i_end=t.finite_vertices_end(); i!=i_end; ++i){
Triangulation::Edge_circulator c = t.incident_edges(i), e;
assert(c != NULL);
while(t.is_infinite(*c))
++c;
e = c;
do{
CGAL::Object obj = t.dual(c);
const Segment*seg = CGAL::object_cast<Segment>(&obj);
const Ray*ray = CGAL::object_cast<Ray>(&obj);
const Line*line = CGAL::object_cast<Line>(&obj);
if(seg) cout << "seg:" << *seg <<endl;
if(ray) cout << "ray:" << *ray <<endl;
if(line) cout << "line:" << *line <<endl;
++c;
while(t.is_infinite(*c))
++c;
}while(c != e);
cout << " --- " << endl;
}
}
- [cgal-discuss] Voronoi diagram - Could some one explain me this output?, Ben Strasser, 01/02/2010
- Re: [cgal-discuss] Voronoi diagram - Could some one explain me this output?, Monique Teillaud, 01/02/2010
Archive powered by MHonArc 2.6.16.