Subject: CGAL users discussion list
List archive
- From: "Laurent Rineau (GeometryFactory)" <>
- To:
- Subject: Re: [cgal-discuss] Control intersection points in AABB tree+ 3D Mesh
- Date: Mon, 23 May 2011 16:47:56 +0200
- Organization: GeometryFactory
On lundi 23 mai 2011 16:01:09
wrote:
> 1) Is my criterion sufficient to choose the two opposite facet? Or I have
> to select all the cells incident to the vertex before setting the
> condition on the "opposite vertex_index"? (In this case I have an error in
> the first argument of the function
> c3t3.triangulation().incident_cells(vh,std::back_inserter(cells)), where I
> set std::vector<Cell_handle> cells. I see that vh=Vertex_handle but I
> don't know how set vh to the vertex pointed by the finite_vertex iterator
> I'm using).
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)...
> 2) 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?
The scalar product is the best way to sort point along a direction.
> 3) 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?
"setting"? Did you mean "testing"? c3t3.is_in_complex(cell) returns true if
the cell is in the volume (3D complex). The facets of a cell that is in the
volume can either be internal to the volume or be on the surface (2D complex).
> I'm sending just the part where my criterion is used. I hope it can be
> understood:
I found errors... See below.
> ....DEFINE CLASS AABB PRIMITIVES (Tr::Finite_facets_iterator Id)
> ....DEFINE TYPES
>
> int main()
> {....MESH A SPHERE AND 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++;
> }
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).
> 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;
Here opposite_vertex_index is an integer i, where:
0 <= i < 4
that corresponds to the number of the facet in the cell. It means that the
vertex that is opposite to the facet (*it) is cell-
>vertex(opposite_vertex_index). Note that this is very different to
V[opposite_vertex_index]!!
> if(opposite_vertex_index= V[vit]) {
Here you do not test the equality between opposite_vertex_index and V[vit]
(anyway, I just said they can only be equal by chance). Instead, you do
something similar to:
opposite_vertex_index = V[vit];
if(opposite_vertex_index != 0) { ....}
According to the indexation you filled in the map V, the condition will only
be false it vit==finite_vertices_begin(). That may explains why you got so
many vertices...
--
Laurent Rineau, PhD
R&D Engineer at GeometryFactory http://www.geometryfactory.com/
Release Manager of the CGAL Project http://www.cgal.org/
- [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.