Subject: CGAL users discussion list
List archive
- From:
- To:
- Subject: Re: [cgal-discuss] Control intersection points in AABB tree+ 3D Mesh
- Date: Mon, 16 May 2011 10:38:06 +0200
- Importance: Normal
Hi Laurent,
I'm posting again the message I sent last week to answer some questions
you asked in order to better understand my topic. Let me know if it is
more clear now.
Thanks again!
<Hi, thank you for your reply!
<My problem is that, for each line which crosses a vertex, I need to
keep/control just the intersection point "before" this vertex.
<<What means "before"?
<I try to do
this by defining this point for each vertex as the point lying in the
facet opposite to the vertex (that is the index defining the facet
coincides with the index of the vertex ).
<<Which facet? In a given cell incident to the vertex, one can speak about
the
opposite facet. But, in your context, what is the cell you consider?
The problem is just define the point "before" with respect to the vertex
of interest. My idea is to select the two cells incident to the vertex
(crossed by a fixed line) and having as facet opposite to this vertex the
facet intersected by the line. I stored a vector pair of intersection
points/intersected primitives which are facets of the triangulation. Then
I run through the facets and I select just the facet which are their
"opposite vertex_index" equal to the index of the vertex of interest. I
would expect to find just two adjacent cells and "compare" the two
intersection points lying in the facets opposite to the vertex. Conversely
I detect a lot of facets where the condition to be facets opposite to the
vertex is fulfilled.
So I'm wondering whether:
Is my criterion sufficient to choose the two opposite facet?
How can I compare the two intersection points lying on these facets in
order to establish the point on the line "before" and "after" the vertex
under study? Is a sort function a good choice or I have to evaluate the
sign of the scalar product between the direction of the oriented line and
a vector connecting the two points?
Moreover I'm setting the condition c3t3.is_in_complex(cell) to be assured
of getting facets belonging the 3D complex. Does it correspond to get
facets both inside the volume and on the surface or surface facets are
excluded?
I certainly plan to share my code but now I'm sending just the part where
my criterion is used. I hope it can be understood:
....DEFINE CLASS AABB PRIMITIVES (Tr::Finite_facets_iterator Id)
....DEFINE TYPES
int main()
{....MESH A SPHERE SET THE TREE
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);
......COMPUTE INTERSECTIONS AND STORE A COUPLE
std::vector<std::pair<Point,Id> >myvector
for ( it=myvector.begin() ; it != myvector.end(); it++ ){
C3t3::Cell_handle cell = (*it).second->first;
int opposite_vertex_index = (*it).second->second;
if(opposite_vertex_index= V[vit]) {
if(c3t3.is_in_complex(cell)) {
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;
}
}
}
}
}
return 0;
}
Thank for any suggestions!
On vendredi 06 mai 2011 15:17:16
wrote:
Hi,
I computed the intersection points of a ray and a 3D object represented as
a 3D complex (for example a tetrahedron mesh in 3D mesh generation). 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 Datum is Triangle_3
and Id is Tr::Facet_finite_iterator. Thus I can get back the triangulation
facet from the intersected Object_and_primitive_id.
So far I understand what you did.
My problem is that, for each line which crosses a vertex, I need to
keep/control just the intersection point "before" this vertex.
What means "before"?
I try to do
this by defining this point for each vertex as the point lying in the
facet opposite to the vertex (that is the index defining the facet
coincides with the index of the vertex ).
Which facet? In a given cell incident to the vertex, one can speak about
the opposite facet. But, in your context, what is the cell you consider?
Because of what I have not understood so far, I have not understood the
rest of the mail either...
What your are doing seems intersting, but you will have to explain more
what you do.
Do you plan to share your code?
I would expect to select in this
way for each vertex just the two intersected facets opposite to the vertex
and, sorting the two corresponding intersection points, to find the
intersection point "before" the vertex. Conversely I detect a lot of
intersections when applying this procedure. Is the adopted criterion
wrong?
Moreover I'm setting the condition c3t3.is_in_complex(cell) for the cell
containing the intersected primitive to be assured of getting facets
belonging the 3D complex. Does it correspond to get facets both inside the
volume and on the surface or surface facets are excluded?
Thanks in advance for any suggestions!
--
Laurent Rineau, PhD
R&D Engineer at GeometryFactory http://www.geometryfactory.com/
Release Manager of the CGAL Project http://www.cgal.org/
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss
- [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.