Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] partitionning Polygon_2 with holes

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] partitionning Polygon_2 with holes


Chronological Thread 
  • From: Thomas Recouvreux <>
  • To:
  • Subject: Re: [cgal-discuss] partitionning Polygon_2 with holes
  • Date: Tue, 7 Feb 2012 19:54:33 +0100

Hi,

it->neighbor(i)->info().index doesn't work for me, I don't understand why (the compilation fails).
Finally I used the adress of FaceHandle as key (index = &(*it)) and that works well.

I succeeded in making my navgraph and use it after the export of the triangulation to python. Thanks for your help !
I will try later to export the triangulation to HDS in order to remove useless edges, I'll let you know.


Thomas

2012/2/6 Sebastien Loriot (GeometryFactory) <>
On 02/06/2012 06:31 PM, Thomas Recouvreux wrote:
Hi again,

In fact I would like to export my partition, for my export I need for
example a list of indexed faces with the index of their neighbors.
I tried to put an "index" variable in FaceInfo, that works well when I
iterate other faces (it->infos().index), but
it->neighbor(i).info().index fails at compilation ( [...] Face_handle’
has no member named ‘info’).
try with
it->neighbor(i)->info().index



Is their an easy way to export triangulation to halfedge structure ?
HDS is low level layer so there is no high level function.
It's not complicated and the documentation is well written, but you
need to do it by hand or using the decorator class.


see
http://www.cgal.org/Manual/latest/doc_html/cgal_manual/HalfedgeDS/Chapter_main.html

http://www.cgal.org/Manual/latest/doc_html/cgal_manual/HalfedgeDS_ref/Class_HalfedgeDS_decorator.html#Cross_link_anchor_1120




2012/2/6 Sebastien Loriot (GeometryFactory) <
<mailto:>>

   On 02/06/2012 05:23 PM, Thomas Recouvreux wrote:



       2012/2/6 Sebastien Loriot (GeometryFactory)
       < <mailto:>
       <mailto: <mailto:>>>



           On 02/06/2012 05:11 PM, Thomas Recouvreux wrote:

               Hi,

               Thanks the Delaunay triangulation works well.
               Do you have a piece of code to remove edges ?

           Do you mean removing constrained edges?

       No I mean remove some edges to fusion triangle into convex polygons.

   A triangulation is by definition triangulated, so you can't do that
   with a Triangulation as underlying data structure.
   To do that you need to export your triangulated polygon into another
   data structure such as the Halfedge data structure for example
   (http://www.cgal.org/Manual/__latest/doc_html/cgal_manual/__HalfedgeDS/Chapter_main.html
   <http://www.cgal.org/Manual/latest/doc_html/cgal_manual/HalfedgeDS/Chapter_main.html>)








               And is there an index for each faces or shall I put it
       in FaceInfo
               structure ?

           You need to use Face_with_info.
           Note that a Face_handle can be use as a key in a map for
       example.

       How can I use Face_handle as a key ??


   Face_handle object are comparable so you can use for example:

   typedef std::set<Face_handle> Face_handle_set;

   Sebastien.



           Sebastien.



               Thomas


               2012/1/18 Mariette Yvinec <
       <mailto:>
       <mailto:__fr
       <mailto:>>
       <mailto:. <mailto:.>____fr


       <mailto:__fr
       <mailto:>>>>


                   Starting from the constrained triangulation of your
       polygons
                   you can appraoch a minimal convex subdivision
                   (I think at most twice the number of parts of the
       optimal)
                   by pulling out as much as you can
                   of non constrained triangulation edges
                   without forming angles greater than 90 degrees.

                   Le 18/01/12 09:27, Sebastien Loriot
       (GeometryFactory) a écrit :

                       The input polygon should be simple and without
       holes.
                       In you case you might want to try to use a
       constrained
                   (Delaunay)
                       triangulation (edges of your polygon are
       constraints).
                       The decomposition would be minimal at all but it
       will be
                   convex.


                       See:
       http://www.cgal.org/Manual/____latest/doc_html/cgal_manual/____Triangulation_2/Chapter_main.____html#Section_36.7
       <http://www.cgal.org/Manual/__latest/doc_html/cgal_manual/__Triangulation_2/Chapter_main.__html#Section_36.7>


       <http://www.cgal.org/Manual/__latest/doc_html/cgal_manual/__Triangulation_2/Chapter_main.__html#Section_36.7
       <http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Triangulation_2/Chapter_main.html#Section_36.7>>


                       Sebastien.

                       Thomas Recouvreux wrote:

                           Hi,

                           I've have found some examples about
       partitionning a
                       Polygon_2,
                           but I didn't see functions for partitionning a
                       Poly_2 with holes.
                           Is there any function to do so or shall I
       decompose
                       first my
                           polygon with holes in polygons without holes and
                       apply the
                           partitionning function ?

                           An other question, I tried to use partition
       function
                       on a polygon
                           with tangente edges (see below), and the
       function
                       return the
                           whole polygon without partionning it, did I miss
                       something ?

                           +-----------------------------____----------+
                           |                                       / |
                           |                                     /   |
                           |                        +----------+   |
                           |                         |           |    |
                           |                        +----------+   |
                           |                                         |
                           |                                         |
                           +-----------------------------____----------+

                           polygon.push_back(Point_2(0, 0));
                           polygon.push_back(Point_2(10, 0));
                           polygon.push_back(Point_2(6, 2));
                           polygon.push_back(Point_2(2, 2));
                           polygon.push_back(Point_2(2, 6));
                           polygon.push_back(Point_2(6, 6));
                           polygon.push_back(Point_2(6, 2));
                           polygon.push_back(Point_2(10, 0));
                           polygon.push_back(Point_2(10, 10));
                           polygon.push_back(Point_2(0,____10));




                           Best
                           Thomas




                   --
                   Mariette Yvinec
                   Geometrica project team
                   INRIA  Sophia-Antipolis






           --
           You are currently subscribed to cgal-discuss.
           To unsubscribe or access the archives, go to
       https://lists-sop.inria.fr/____wws/info/cgal-discuss
       <https://lists-sop.inria.fr/__wws/info/cgal-discuss>

       <https://lists-sop.inria.fr/__wws/info/cgal-discuss
       <https://lists-sop.inria.fr/wws/info/cgal-discuss>>




   --
   You are currently subscribed to cgal-discuss.
   To unsubscribe or access the archives, go to
   https://lists-sop.inria.fr/__wws/info/cgal-discuss
   <https://lists-sop.inria.fr/wws/info/cgal-discuss>




--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss





Archive powered by MHonArc 2.6.16.

Top of Page