Subject: CGAL users discussion list
List archive
- From: Monique Teillaud <>
- To:
- Subject: Re: [cgal-discuss] Geometry in a 2D periodic triangulation
- Date: Wed, 13 Nov 2013 17:28:15 +0100
Dear Daniel,
I guess that function periodic_point(face,index) should help you.
http://doc.cgal.org/latest/Periodic_2_triangulation_2/classCGAL_1_1Periodic__2__triangulation__2.html#a16806236a206a836a37e0ce58c961aed
Or periodic_segment(face,index)
http://doc.cgal.org/latest/Periodic_2_triangulation_2/classCGAL_1_1Periodic__2__triangulation__2.html#a50b4f8adcb511d4102b0e3c6f803bb9d
Once you get a periodic point, you know how to translate the point
see also http://doc.cgal.org/latest/Periodic_2_triangulation_2/index.html#P2Triangulation2secspace
Then you can just use standard geometric computations from the CGAL kernel.
Hope this helps.
Best,
Monique
Le 13/11/13 14:15, Daniel Duque a écrit :
Hello,
I have finally been able to have a look at this exciting new feature of
CGAL. I would love to say that I understand everything on the manual,
but sadly this is not the case. At any rate, after building the periodic
triangulation I get a list of vertices whose Cartesian coordinates are
all within the original domain. Usually, there is only one covering, so
there are just as many vertices as the points I used as input.
My question is: imagine I now want to compute geometrical stuff, say
distances between all neighboring nodes. The triangulation build has the
proper connectivity, so two vertices that are close to the edge of the
domain and quite far apart may in fact be periodic neighbors. In order
to do such a thing, I would do this kind of loop:
for( Finite_edges_iterator ed=T.finite_edges_begin();
ed!=T.finite_edges_end();
ed++) {
FT l2=per_dist2(v0->point(), v1->point());
// ... print out, collect stats, whatever
}
The "finite" I think can be dropped in this case. I have been careful
not to compute the distance between the points, but a periodic distance,
following what is called the minimum image convention:
// LL is the size of the periodic domain
FT per_dist(const FT& x1, const FT& x2) {
FT dx=x1-x2;
if(fabs(dx)>LL/2.0)
if(dx>0)
dx -= LL;
else
dx += LL;
return dx;
}
FT per_dist2(const Point& P1, const Point& P2) {
FT dx=per_dist(P1.x(),P2.x());
FT dy=per_dist(P1.y(),P2.y());
return dx*dx+dy*dy;
}
I would like to get some reassurance that what I am doing is correct.
Not very elegant, perhaps, and even redundant (there may be some CGAL
function that does just this), but in the end correct (all edges are
taken into account just once, for example).
Thanks very much,
Daniel
--
Monique Teillaud
http://www.inria.fr/sophia/members/Monique.Teillaud/
INRIA Sophia Antipolis - Méditerranée
Institut National de Recherche en Informatique et Automatique
- [cgal-discuss] Geometry in a 2D periodic triangulation, Daniel Duque, 11/13/2013
- Re: [cgal-discuss] Geometry in a 2D periodic triangulation, Monique Teillaud, 11/13/2013
- Re: [cgal-discuss] Geometry in a 2D periodic triangulation, Daniel Duque, 11/13/2013
- Re: [cgal-discuss] Geometry in a 2D periodic triangulation, Monique Teillaud, 11/13/2013
- Re: [cgal-discuss] Geometry in a 2D periodic triangulation, Daniel Duque, 11/14/2013
- Re: [cgal-discuss] Geometry in a 2D periodic triangulation, Monique Teillaud, 11/13/2013
- Re: [cgal-discuss] Geometry in a 2D periodic triangulation, Daniel Duque, 11/13/2013
- Re: [cgal-discuss] Geometry in a 2D periodic triangulation, Monique Teillaud, 11/13/2013
Archive powered by MHonArc 2.6.18.