Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Calculating area of polygon (Gps_traits_2::Polygon_with_holes_2)

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Calculating area of polygon (Gps_traits_2::Polygon_with_holes_2)


Chronological Thread 
  • From: zjkg <>
  • To:
  • Subject: Re: [cgal-discuss] Calculating area of polygon (Gps_traits_2::Polygon_with_holes_2)
  • Date: Tue, 25 May 2010 06:46:30 +0200 (CEST)

1. Call Polygon_with_holes_2::outer_boundary() function to get outer boundary
of the polygon. Let's name the outer boundary of polygon "A".
2. Call "A".area() function to get the area of outer boundary. (If you'are
using arc as a segment of polygon, area() function would not be found.... so
that you must make the area() function yourself......)
3. For all holes (use holes_begin() and holes_end() to get all holes) call
area() function. And then sum all areas of holes(Check the area of hole is
negative).
4. if area() function return negative area for hole
Your area = Area of outer boundary + Area of all holes
else
Your area = Area of outer boundary - Area of all holes

just a guess....



Archive powered by MHonArc 2.6.16.

Top of Page