vgl_area.h
Go to the documentation of this file.
1 #ifndef vgl_area_h_
2 #define vgl_area_h_
3 //:
4 // \file
5 
6 template <class T> class vgl_polygon;
7 template <class T> class vgl_point_2d;
8 template <class T> class vgl_box_2d;
9 template <class T> class vgl_oriented_box_2d;
10 //: Computes the signed area of a polygon.
11 // The sign is positive if the polygon is oriented counter-clockwise
12 // (in RH coordinate system) and negative otherwise. For "polygons"
13 // consisting of more than one contour, the result is valid only if
14 // the contours are oriented consistently. That is, an enclosed
15 // contour must have opposite orientation to the enclosing contour.
16 // \sa vgl_area
17 // \relatesalso vgl_polygon
18 template <class T> T vgl_area_signed(vgl_polygon<T> const& poly);
19 
20 //: The area of a polygon.
21 // \sa vgl_area_signed
22 // \relatesalso vgl_polygon
23 template <class T> T vgl_area(vgl_polygon<T> const& poly);
24 
25 //: The orientation enforced area of a polygon.
26 // \note This method assumes that the polygon is simple (i.e. no crossings)
27 // and the correct orientation is 'enforced' on the polygon (i.e. holes are
28 // given negative area) to ensure that the resultant area is correct
29 // \sa vgl_area
30 // \relatesalso vgl_polygon
31 template <class T> T vgl_area_enforce_orientation(vgl_polygon<T> const& poly);
32 
33 //: The area weighted center of a polygon
34 // In general this is different than the mean of the polygon's vertices
35 // \relatesalso vgl_polygon
36 template <class T> vgl_point_2d<T> vgl_centroid(vgl_polygon<T> const& poly);
37 
38 //: The area of an axis-aligned box
39 template <class T> T vgl_area(vgl_box_2d<T> const& box);
40 
41 //: area of an oriented box
42 template <class T> T vgl_area(vgl_oriented_box_2d<T> const& obox);
43 
44 #define VGL_AREA_INSTANTIATE(T) extern "please include vgl/vgl_area.hxx instead"
45 
46 #endif // vgl_area_h_
vgl_point_2d< T > vgl_centroid(vgl_polygon< T > const &poly)
The area weighted center of a polygon.
Represents a cartesian 2D box.
Definition: vgl_area.h:8
T vgl_area_signed(vgl_polygon< T > const &poly)
Computes the signed area of a polygon.
Represents a cartesian 2D point.
Definition: vgl_area.h:7
T vgl_area_enforce_orientation(vgl_polygon< T > const &poly)
The orientation enforced area of a polygon.
Definition: vgl_area.hxx:61
Store a polygon.
Definition: vgl_area.h:6
T vgl_area(vgl_polygon< T > const &poly)
The area of a polygon.