Subject: CGAL users discussion list
List archive
- From: "Vu, Khuong" <>
- To: "" <>
- Subject: [cgal-discuss] RE: Voronoi edge dual from Delaunay edge error
- Date: Wed, 1 Jul 2009 22:39:46 -0500
- Accept-language: en-US
- Acceptlanguage: en-US
Hi all,
I've posted a lot of my troubles but I haven't received any reply, even a
negative one. So, I'm wondering if you guys get my emails or not. If you
received my emails, but no one even took a look at them, I must think that my
troubles were too hard and no one had got before, or nobody even cares about
help the others. I think the later is much more reasonable!
Anyway, if any of you receives this, please reply to me with anything so that
I know that my emails reached you.
Thanks
Khuong
________________________________________
From: Vu, Khuong
Sent: Wednesday, July 01, 2009 8:05 PM
To:
Subject: Voronoi edge dual from Delaunay edge error
Dear all,
I'd like to ask your advice for my following code, in which I constructed a
Delaunay diagram, then iterate each edge and get its dual, which is a Voronoi
edge, then print it out.
My problems are:
1. The code didn't work at the command dealing with the Voronoi edge. The
error was Segmentation.
2. I tried an alternative: I constructed the dual of a Delaunay diagram then
printed the edge information. However, there was 1 face vanished, i.e., there
were 6 vertices in the Delaunay graph, but only 5 Voronoi faces were
constructed. This also happened when I tried to construct the Voronoi diagram
directly (without no conversion from the Delaunay diagram)
I wondered if this is a bug or it is on purpose?
I would very appreciate any comment/advice from you guys. Thanks!
Khuong
#include <CGAL/basic.h>
// standard includes
#include <iostream>
#include <fstream>
#include <cassert>
#include <vector>
#include <cmath>
#include <map>
// define the exact number type
# include <CGAL/Quotient.h>
# include <CGAL/MP_Float.h>
typedef CGAL::Quotient<CGAL::MP_Float> ENT;
// define the kernels
#include <CGAL/Simple_cartesian.h>
typedef CGAL::Simple_cartesian<double> CK;
typedef CGAL::Simple_cartesian<ENT> EK;
// typedefs for the traits and the algorithm
#include <CGAL/Segment_Delaunay_graph_filtered_traits_2.h>
#include <CGAL/Segment_Delaunay_graph_2.h>
#include <CGAL/Voronoi_diagram_2.h>
#include <CGAL/Segment_Delaunay_graph_adaptation_traits_2.h>
#include <CGAL/Segment_Delaunay_graph_filtered_traits_2.h>
#include <CGAL/Segment_Delaunay_graph_traits_2.h>
#include <CGAL/Segment_Delaunay_graph_adaptation_policies_2.h>
# define M_PI 3.14159265358979323846 /* pi */
typedef CGAL::Segment_Delaunay_graph_filtered_traits_2<CK,
/* The construction kernel allows for / and sqrt */
CGAL::Field_with_sqrt_tag,
EK,
/* The exact kernel supports field ops exactly */ CGAL::Field_tag>
Gt;
typedef CGAL::Segment_Delaunay_graph_2<Gt>
SDG2;
typedef
CGAL::Segment_Delaunay_graph_caching_degeneracy_removal_policy_2<SDG2>
AP;
typedef CGAL::Segment_Delaunay_graph_adaptation_traits_2<SDG2>
AT;
typedef CGAL::Voronoi_diagram_2<SDG2, AT, AP>
VD;
typedef AT::Site_2 Site_2;
typedef AT::Point_2 Point_2;
//typedef CGAL::Point_2<CK> Point_2;
typedef VD::Vertex_handle
Vertex_handle;
typedef VD::Face_handle
Face_handle;
typedef VD::Halfedge_handle
Halfedge_handle;
typedef VD::Ccb_halfedge_circulator
Ccb_halfedge_circulator;
typedef VD::Halfedge_around_vertex_circulator
Halfedge_around_vertex_circulator;
typedef VD::Face_iterator
Face_iterator;
typedef VD::Locate_result
Locate_result;
typedef SDG2::Vertex_handle
Delaunay_vertex_handle;
typedef SDG2::All_vertices_iterator
All_vertices_iterator;
typedef SDG2::Edge_circulator
Edge_circulator;
using namespace std;
int main(){
/*
suspect_4.cin contains 2 sites:
s 224.5 638 154.5 136
s 74 432 126 418
*/
ifstream ifs("./suspect_4.cin");
assert( ifs );
SDG2 sdg;
SDG2::Site_2 site;
int count = 0;
while ( ifs >> site ) { sdg.insert( site ); }
ifs.close();
assert( sdg.is_valid(true, 1) );
cout << endl << endl;
VD vd1;
All_vertices_iterator iter_ver = sdg.all_vertices_begin();
do{
if (!sdg.is_infinite(iter_ver)){
Edge_circulator eit_begin =
sdg.incident_edges(iter_ver);
Edge_circulator eit= eit_begin;
do{
Halfedge_handle e = vd1.dual(*eit);
if (e->has_source()) cout << "source: " <<
e->source()->point() << endl;
else cout << "source: inf\r\n";
if (e->has_target()) cout << "target: " <<
e->target()->point() << endl;
else cout << "target: inf\r\n";
}while(++eit!=eit_begin);
}else{
}
}while(++iter_ver != sdg.all_vertices_end());
}
- [cgal-discuss] Voronoi edge dual from Delaunay edge error, Vu, Khuong, 07/02/2009
- [cgal-discuss] RE: Voronoi edge dual from Delaunay edge error, Vu, Khuong, 07/02/2009
- Re: [cgal-discuss] RE: Voronoi edge dual from Delaunay edge error, Olivier Devillers, 07/02/2009
- RE: [cgal-discuss] RE: Voronoi edge dual from Delaunay edge error, Vu, Khuong, 07/02/2009
- Re: [cgal-discuss] RE: Voronoi edge dual from Delaunay edge error, Olivier Devillers, 07/02/2009
- [cgal-discuss] RE: Voronoi edge dual from Delaunay edge error, Vu, Khuong, 07/02/2009
Archive powered by MHonArc 2.6.16.