Subject: CGAL users discussion list
List archive
- From: jiatao83 <>
- To:
- Subject: [cgal-discuss] Something about Segment_Delaunay_graph
- Date: Mon, 8 Sep 2008 16:51:17 +0800 (CST)
Hi all:
I am a beginner at CGAL, and find it a great library providing powerful algorithms for compute geometry. I tried to compile the Segment_Delaunay_graph_2 example(C:\Program Files\CGAL-3.3.1\examples\Segment_Delaunay_graph_2),but failed. The compile error is "error C2244: 'CGAL::Sdg2<Gt,ST,DS,LTag>::insert_point_on_segment' : unable to match function definition to an existing declaration". I tried to check the function declaration,but could not find anything wrong. Could someone help me? Thanks very much! Any suggestion is appreciated!
regards.
taojia
pls see the soure code below:
#include <CGAL/basic.h>
// standard includes
#include <iostream>
#include <fstream>
#include <cassert>
#include <string>
#include <iostream>
#include <fstream>
#include <cassert>
#include <string>
// define the kernel
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Filtered_kernel.h>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Filtered_kernel.h>
typedef CGAL::Simple_cartesian<double> CK;
typedef CGAL::Filtered_kernel<CK> Kernel;
typedef CGAL::Filtered_kernel<CK> Kernel;
// typedefs for the traits and the algorithm
#include <CGAL/Segment_Delaunay_graph_traits_2.h>
#include <CGAL/Segment_Delaunay_graph_2.h>
#include <CGAL/Segment_Delaunay_graph_traits_2.h>
#include <CGAL/Segment_Delaunay_graph_2.h>
typedef CGAL::Segment_Delaunay_graph_traits_2<Kernel> Gt;
typedef CGAL::Segment_Delaunay_graph_2<Gt> SDG2;
typedef CGAL::Segment_Delaunay_graph_2<Gt> SDG2;
using namespace std;
int main()
{
ifstream ifs("data/sites2.cin");
assert( ifs );
{
ifstream ifs("data/sites2.cin");
assert( ifs );
SDG2 sdg;
SDG2::Site_2 site;
SDG2::Site_2 site;
// read the sites from the stream and insert them in the diagram
while ( ifs >> site ) { sdg.insert( site ); }
while ( ifs >> site ) { sdg.insert( site ); }
ifs.close();
// validate the diagram
assert( sdg.is_valid(true, 1) );
cout << endl << endl;
assert( sdg.is_valid(true, 1) );
cout << endl << endl;
/*
// now walk through the non-infinite edges of the segment Delaunay
// graphs (which are dual to the edges in the Voronoi diagram) and
// print the sites defining each Voronoi edge.
//
// Each oriented Voronoi edge (horizontal segment in the figure
// below) is defined by four sites A, B, C and D.
//
// \ /
// \ B /
// \ /
// C ----------------- D
// / \
// / A \
// / \
//
// The sites A and B define the (oriented) bisector on which the
// edge lies whereas the sites C and D, along with A and B define
// the two endpoints of the edge. These endpoints are the Voronoi
// vertices of the triples A, B, C and B, A, D.
// If one of these vertices is the vertex at infinity the string
// "infinite vertex" is printed; the corresponding Voronoi edge is
// actually a stright-line or parabolic ray.
// The sites below are printed in the order A, B, C, D.
*/
// now walk through the non-infinite edges of the segment Delaunay
// graphs (which are dual to the edges in the Voronoi diagram) and
// print the sites defining each Voronoi edge.
//
// Each oriented Voronoi edge (horizontal segment in the figure
// below) is defined by four sites A, B, C and D.
//
// \ /
// \ B /
// \ /
// C ----------------- D
// / \
// / A \
// / \
//
// The sites A and B define the (oriented) bisector on which the
// edge lies whereas the sites C and D, along with A and B define
// the two endpoints of the edge. These endpoints are the Voronoi
// vertices of the triples A, B, C and B, A, D.
// If one of these vertices is the vertex at infinity the string
// "infinite vertex" is printed; the corresponding Voronoi edge is
// actually a stright-line or parabolic ray.
// The sites below are printed in the order A, B, C, D.
*/
string inf_vertex("infinite vertex");
char vid[] = {'A', 'B', 'C', 'D'};
char vid[] = {'A', 'B', 'C', 'D'};
SDG2::Finite_edges_iterator eit = sdg.finite_edges_begin();
for (int k = 1; eit != sdg.finite_edges_end(); ++eit, ++k) {
SDG2::Edge e = *eit;
// get the vertices defining the Voronoi edge
SDG2::Vertex_handle v[] = { e.first->vertex( sdg.ccw(e.second) ),
e.first->vertex( sdg.cw(e.second) ),
e.first->vertex( e.second ),
sdg.tds().mirror_vertex(e.first, e.second) };
for (int k = 1; eit != sdg.finite_edges_end(); ++eit, ++k) {
SDG2::Edge e = *eit;
// get the vertices defining the Voronoi edge
SDG2::Vertex_handle v[] = { e.first->vertex( sdg.ccw(e.second) ),
e.first->vertex( sdg.cw(e.second) ),
e.first->vertex( e.second ),
sdg.tds().mirror_vertex(e.first, e.second) };
cout << "--- Edge " << k << " ---" << endl;
for (int i = 0; i < 4; i++) {
// check if the vertex is the vertex at infinity; if yes, print
// the corresponding string, otherwise print the site
if ( sdg.is_infinite(v[i]) ) {
cout << vid[i] << ": " << inf_vertex << endl;
} else {
cout << vid[i] << ": " << v[i]->site() << endl;
}
}
cout << endl;
}
for (int i = 0; i < 4; i++) {
// check if the vertex is the vertex at infinity; if yes, print
// the corresponding string, otherwise print the site
if ( sdg.is_infinite(v[i]) ) {
cout << vid[i] << ": " << inf_vertex << endl;
} else {
cout << vid[i] << ": " << v[i]->site() << endl;
}
}
cout << endl;
}
return 0;
}
}
买房不必东奔西走,上房老大,看"二手房"网上房展会
- Re: [cgal-discuss] Min_circle problem, (continued)
- Re: [cgal-discuss] Min_circle problem, Atul Thakur, 09/08/2008
- Re: [cgal-discuss] Min_circle problem, Atul Thakur, 09/11/2008
- Re: [cgal-discuss] Min_circle problem, Bernd Gaertner, 09/11/2008
- Message not available
- Re: [cgal-discuss] Min_circle problem, Atul Thakur, 09/11/2008
- Re: [cgal-discuss] Min_circle problem, Andreas Fabri, 09/11/2008
- Re: [cgal-discuss] Min_circle problem, Atul Thakur, 09/11/2008
- Re: [cgal-discuss] Min_circle problem, Atul Thakur, 09/11/2008
- Re: [cgal-discuss] Min_circle problem, Atul Thakur, 09/11/2008
- Re: [cgal-discuss] Min_circle problem, Bernd Gaertner, 09/12/2008
- Re: [cgal-discuss] Min_circle problem, Michael Hoffmann, 09/12/2008
- Re: [cgal-discuss] Min_circle problem, Atul Thakur, 09/11/2008
- Message not available
- Re: [cgal-discuss] Min_circle problem, Bernd Gaertner, 09/11/2008
- Re: [cgal-discuss] Min_circle problem, Atul Thakur, 09/11/2008
- Re: [cgal-discuss] Min_circle problem, Atul Thakur, 09/08/2008
- Re: [cgal-discuss] Something about Segment_Delaunay_graph, brunokim.mc, 09/10/2008
Archive powered by MHonArc 2.6.16.