Subject: CGAL users discussion list
List archive
- From:
- To:
- Subject: [cgal-discuss] about function incident_facets
- Date: Tue, 27 Apr 2010 14:40:48 +0200 (MEST)
- Importance: Normal
I'm using the function incident_facets( Vertex handle v, OutputIterator
facets) in order to find incidents facets to a vertex stored in C2T3 as
result of meshing a sphere.
This doesn't work as I could expect for a two-dimensional complex. In
fact, when searching for the duals points of facets incidents to a vertex
I obtain only segment (three-dimensional case) and adding the condition
for cells on the surface I don't find dual object.
Thanks for any suggestion!
Here part of the code to clarify:
#include <CGAL/Surface_mesh_default_triangulation_3.h>
#include <CGAL/Complex_2_in_triangulation_3.h>
#include <iostream>
#include <map>
#include <vector>
typedef CGAL::Surface_mesh_default_triangulation_3 Tr;
typedef CGAL::Complex_2_in_triangulation_3<Tr> C2t3;
typedef Tr::Geom_traits GT;
typedef GT::Point_3 Point_3;
typedef GT:: Segment_3 Segment_3;
typedef C2t3::Triangulation Tr;
typedef Tr::Finite_vertices_iterator Finite_vertices_iterator;
typedef Tr::Vertex_handle Vertex_handle;
typedef Tr::Facet Facet;
int main() {
Tr tr;
C2t3 c2t3 (tr);
//...generating mesh and storing it in C2T3
std::map<Vertex_handle, int> V;
CGAL_triangulation_precondition (c2t3.triangulation().dimension()==
3);
int inum = 0;
for( Finite_vertices_iterator
vit = c2t3.triangulation().finite_vertices_begin(); vit !=
c2t3.triangulation().finite_vertices_end(); ++vit) {
V[vit] = inum++;
Point_3 pp = static_cast<Point_3>(vit->point());
std::cout << pp.x() << " " << pp.y() << " " << pp.z() << "\n";
CGAL_triangulation_precondition
(c2t3.triangulation().is_vertex(vit));
std::vector<Facet> facets;
c2t3.triangulation().finite_incident_facets(vit,std::back_inserter(facets));
std::vector<Facet>::iterator it_facet= facets.begin();
for(; it_facet != facets.end() ; ++it_facet)
if
((*it_facet).first->is_facet_on_surface((*it_facet).second)==true)
{
CGAL:: Object obj=tr.dual(*it_facet);
Point_3 point;
Segment_3 segment;
if (assign(point,obj)) {std::cout<<"POINT"<<std::endl;
/* do something with *point */
} else if (assign(segment, obj))
{std::cout<<"SEGMENT"<<std::endl;
/* do something with segment*/
}
}
}
}
- [cgal-discuss] about function incident_facets, cecilia, 04/27/2010
Archive powered by MHonArc 2.6.16.