Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] AABB tree+ 3D Mesh

Subject: CGAL users discussion list

List archive

[cgal-discuss] AABB tree+ 3D Mesh


Chronological Thread 
  • From:
  • To:
  • Subject: [cgal-discuss] AABB tree+ 3D Mesh
  • Date: Thu, 26 May 2011 18:11:04 +0200
  • Importance: Normal


Hi Sebastien, thank you for your reply!
Unfortunately I'm not sure to understand:
<According to the code I see, you do not use the fact that this is a
<mesh, because you consider all finite facets.
1)Do you mean that is not correct to use finite facets?I made this because
I build a class AABB_triangulation_triangle_primitive where Id is
Tr::Finite_facets_iterator Id in order to get back the vertexes of the
intersected facets for each intersection point. Should I use a different
iterator?

<Suppose that the line does not intersect the opposite facets on an edge.
<Given a vertex, they are two cases:

< if the vertex v is not incident to the infinite vertex:
<the set of finite cells incident to v is a topological ball with
<the point of v in the interior the ball. So in that case you must
<intersect exactly two facets opposite to v.

2) So, if I want select this case in order to define an intersection point
"before" and "after" the vertex (sorting the two vertex on the two
intersected facets along the line query crossing the vertex), I have to
test a condition such as "v is not incident to the infinite vertex"? In
the manual I find just a vertex circulator
t.incident_vertices(t.infinite_vertex().......
But what it means exclude the possibility to have v as incident to the
infinite vertex?
Thanks again
C.


< if the vertex v is incident to the infinite vertex:
<then the set of finite cells incident to v is a topological ball with
<the point of v on the boundary of that ball. Due to the convexity of
<any small neighborhood of v, the number of intersected facets opposite
<to v ranges from 0 to 1 (it depends on the direction).

S.














Hi,
I'm sorry to ask on the same topic, but I could not interpret my results.
So just a question on my starting hypothesis.
I recall I combined a 3D mesh generation procedure with an AABB tree. My
query object
is a line with fixed direction and crossing a vertex of the mesh (I
consider parallel rays crossing each vertex for different intersection
queries) and I use a kind of AABB_primitive, such as Id is
Tr::Facet_finite_iterator.
With the condition
f(vit->point()==cell->vertex(opposite_vertex_index)->point()) in the
attached code, for each vertex in the iteration of
Finite_vertices_iterator, I want select the intersected facets,in the list
of intersected primitives, which have this vertex as opposite vertex. I
would expect to find just two cells incident to the vertex and
containing the intersected facets and sort along the direction of the
intersection line query the two intersection points lying in these two
facets opposite to the vertex.
This should allow me to define an intersection point "before" and an
intersection point "after" the vertex of interest for each step.

Conversely I detect almost everywhere just one intersection and not 2 as
expected.Two intersection are very seldom detected. It depends on the mesh
size. If I reduce the size of tetrahedra and facets I detect more double
intersections. Otherwise, when these sizes are increased double
intersections disappear.

1) So, fixed a vertex and a line crossing it there are not necessarily two
incident cells containing two intersected facets which are facets opposite
to the fixed vertex?I'm wondering whether this hypothesis is false, or I
make some mistakes in applying it.

Below the code.....

Thanks for your attention!

int main()
{....MESH A SPHERE
Tree
tree(c3t3.triangulation().finite_facets_begin(),c3t3.triangulation().finite_facets_end());
Point a(0.0, 0.0, 0.0);
Point b(0.0, 1.0, 0.0);
Ray ray_query(a,b);
Direction dir(ray_query);
std::map<Vertex_handle, int> V;
int inum = 0;
for( Finite_vertices_iterator vit =
c3t3.triangulation().finite_vertices_begin();
vit != c3t3.triangulation().finite_vertices_end();
++vit)
{
V[vit] = inum++;
}

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(vit->point()==cell->vertex(opposite_vertex_index)->point()) {
std::cout<<vit->point()<< " "<<" "<<" "<<"
"<<cell->vertex(opposite_vertex_index)->point()<<std::endl;
if(c3t3.is_in_complex(cell)==true) {
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;
}
}
}
}















Archive powered by MHonArc 2.6.16.

Top of Page