Subject: CGAL users discussion list
List archive
- From: sanlington <>
- To: cgal-discuss <>
- Subject: Re:[cgal-discuss] How to extract edges of a mesh
- Date: Mon, 3 Aug 2009 08:40:43 +0800 (CST)
Hi ,Morteza Romoozi
the edges in 2D mesh is hold implicitly,not like the face or the vertex,but you can access the coordinates of edges through the Face_handle and index.
i pasted the example code from:http://www.cgal.org/Manual/3.5/doc_html/cgal_manual/Mesh_2/Chapter_main.html, and added some codes between the /****...**/ lines to show how to access edge's coordinates:
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
#include <CGAL/Triangulation_conformer_2.h>
#include <iostream>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Constrained_Delaunay_triangulation_2<K> CDT;
typedef CDT::Point Point;
typedef CDT::Vertex_handle Vertex_handle;
int main()
{
CDT cdt;
// construct a constrained triangulation
Vertex_handle
va = cdt.insert(Point( 5., 5.)),
vb = cdt.insert(Point(-5., 5.)),
vc = cdt.insert(Point( 4., 3.)),
vd = cdt.insert(Point( 5.,-5.)),
ve = cdt.insert(Point( 6., 6.)),
vf = cdt.insert(Point(-6., 6.)),
vg = cdt.insert(Point(-6.,-6.)),
vh = cdt.insert(Point( 6.,-6.));
cdt.insert_constraint(va,vb);
cdt.insert_constraint(vb,vc);
cdt.insert_constraint(vc,vd);
cdt.insert_constraint(vd,va);
cdt.insert_constraint(ve,vf);
cdt.insert_constraint(vf,vg);
cdt.insert_constraint(vg,vh);
cdt.insert_constraint(vh,ve);
std::cout << "Number of vertices before: "
<< cdt.number_of_vertices() << std::endl;
// make it conforming Delaunay
CGAL::make_conforming_Delaunay_2(cdt);
std::cout << "Number of vertices after make_conforming_Delaunay_2: "
<< cdt.number_of_vertices() << std::endl;
// then make it conforming Gabriel
CGAL::make_conforming_Gabriel_2(cdt);
std::cout << "Number of vertices after make_conforming_Gabriel_2: "
<< cdt.number_of_vertices() << std::endl;
/******* you can access the coordinates of edges like this *******************************/
typedef CDT::Finite_edges_iterator FEit;
typedef CDT::Edge Edge;
for (FEit eit= cdt.finite_edges_begin(); eit!= cdt.finite_edges.end(); eit++ )
{
Edge e= *eit;
Point s= e.first->vertex((e.second+1)%3)->point(),
t= e.first->vertex((e.second+2)%3)->point();
std::cout<<"s="<<s<<std::endl
<<"t="<<t<<std::endl;
}
/********************************************************************/
}
在2009-08-02,"Morteza Romoozi" <> 写道:
Hii nead a mesher algorithm that mesh a terrain with excepted sites, and can deliver me edges of this mesh.i visit below link but i dont know how to extract edges of the mesh
没有广告的终身免费邮箱,www.yeah.net
- [cgal-discuss] How to extract edges of a mesh, Morteza Romoozi, 08/02/2009
- [cgal-discuss] , sedigheh mahdavi, 08/02/2009
- RE: [cgal-discuss] , Amir Vaxman, 08/02/2009
- Re:[cgal-discuss] How to extract edges of a mesh, sanlington, 08/03/2009
- Re:[cgal-discuss] How to extract edges of a mesh, Morteza Romoozi, 08/12/2009
- Re: [cgal-discuss] How to extract edges of a mesh, Manuel Caroli, 08/12/2009
- Re:[cgal-discuss] How to extract edges of a mesh, Morteza Romoozi, 08/12/2009
- [cgal-discuss] , sedigheh mahdavi, 08/02/2009
Archive powered by MHonArc 2.6.16.