Subject: CGAL users discussion list
List archive
- From:
- To:
- Subject: Re: [cgal-discuss] Control intersection points in AABB tree+ 3D Mesh
- Date: Tue, 24 May 2011 19:13:08 +0200
- Importance: Normal
Hi Laurent,
clearly in my last mail it was "Thanks for your reply!" and not "Thanks
for your reply?", sorry for the mistake!
<Here you create an indexation of finite vertices of the triangulation, in
the
<order of iteration using finite_vertices_(begin|end)()... The numeration
is <only for you. Internally <the triangulation data structure does not
keep such <an indexation (just handles or iterators).
If I understand better your reply the triangulation data structure has its
own internal indexation which is "local" ( I mean each cell gives access
to its four incident vertices and to its four adjacent cells, the four
vertices of a cell are indexed with 0, 1, 2 and 3) and not a "global" map
(as I tried to do with my numeration, see the attached code, from 0 to the
number of vertexes). Then the points in the 3D object can be retrieved
with vertex->point().
So an indexation of finite vertices of the triangulation in the order of
iteration can be used just to assign an index to each vertex in the space,
for example in order to write the indices in an output file as done in
File_medit. Did you mean this?
In this case, (to be assured of getting the "true" opposite vertex in the
space) the statement I used to select the index of the vertex (crossed by
the line query) opposite to the intersected facet, that is
if(opposite_vertex_index==V[vit]), should be replaced with a condition for
the vertexes if((*vopp=*vit) where const Vertex_handle&
vopp=cell->vertex(opposite_vertex_index).
This test gives me a conversion error.
<I do not know. I had a look at your code but I do not know how you fill
the <vector myvector. Maybe the error is here. Actually I found other
errors (see <below)...
I attach the procedure to fill the vector myvector and my guess for the
equality test.
for( Finite_vertices_iterator vit =
c3t3.triangulation().finite_vertices_begin();
vit != c3t3.triangulation().finite_vertices_end();
++vit)
{
Point c = vit->point();
Line line_vertex(c,dir);
std::cout <<
tree.number_of_intersected_primitives(line_vertex)
<< " intersected primitives"<<std::endl;
// computes all intersections with line query
std::list<Object_and_primitive_id> intersections;
tree.all_intersections(line_vertex,
std::back_inserter(intersections));
std::list<Object_and_primitive_id>::iterator it_intersections=
intersections.begin();
std::list<Primitive_id> primitives;
std::vector<std::pair<Point,Id> > myvector;
std::vector<std::pair<Point,Id> >::iterator it;
tree.all_intersected_primitives(line_vertex,
std::back_inserter(primitives));
for(; it_intersections != intersections.end() ;
++it_intersections)
{
// get intersection object
Object_and_primitive_id op = *it_intersections;
CGAL::Object object = op.first;
Id id=op.second;
Point point;
Segment segment;
if(CGAL::assign(point,object))
{
it=myvector.begin();
myvector.insert(it, make_pair(point,id));
}
else if(CGAL::assign(segment,object))
std::cout << "intersection object is a
segment" <<std::endl;
}
std::sort(myvector.begin(), myvector.end(), sort_pred());
for ( it=myvector.begin() ; it != myvector.end(); it++ ){
C3t3::Cell_handle cell = (*it).second->first;
int opposite_vertex_index = (*it).second->second;
const Vertex_handle& vopp=cell->vertex(opposite_vertex_index);
//if(opposite_vertex_index==V[vit]) {OLD TEST
if(*vopp=*vit) {
if(c3t3.is_in_complex(cell)) {
std::cout << " intersection/coordinates"<<"
"<<std::setprecision(15)<<(*it).first << " => " << std::endl;
for(int i = 0; i < 4; i++){
const Vertex_handle& vh = (*((*it).second)).first->vertex(i);
std::cout<<"
vertex index:"<<" " <<V[vh] << " "<<std::endl;
std::cout <<" vertex coordinates:"<<"
"<<vh->point().x()<<"
"<<vh->point().y()<<" "<<vh->point().z()<<std::endl;
}
}
}
}
Thanks again!
- [cgal-discuss] Control intersection points in AABB tree+ 3D Mesh, cecilia, 05/06/2011
- Re: [cgal-discuss] Control intersection points in AABB tree+ 3D Mesh, Laurent Rineau (GeometryFactory), 05/06/2011
- <Possible follow-up(s)>
- Re: [cgal-discuss] Control intersection points in AABB tree+ 3D Mesh, cecilia, 05/09/2011
- Re: [cgal-discuss] Control intersection points in AABB tree+ 3D Mesh, cecilia, 05/16/2011
- Re: [cgal-discuss] Control intersection points in AABB tree+ 3D Mesh, cecilia, 05/23/2011
- Re: [cgal-discuss] Control intersection points in AABB tree+ 3D Mesh, Laurent Rineau (GeometryFactory), 05/23/2011
- Re: [cgal-discuss] Control intersection points in AABB tree+ 3D Mesh, cecilia, 05/23/2011
- Re: [cgal-discuss] Control intersection points in AABB tree+ 3D Mesh, cecilia, 05/24/2011
- Re: [cgal-discuss] Control intersection points in AABB tree+ 3D Mesh, cecilia, 05/25/2011
Archive powered by MHonArc 2.6.16.