22 # include <vcl_msvc_warnings.h> 120 for (
unsigned int i=0;i<
num_sheets();++i) c += (
unsigned int)(
sheets_[i].size());
130 std::ostream&
print(std::ostream&)
const;
133 std::istream&
read(std::istream&);
167 std::vector<std::pair<unsigned,unsigned> >& e1,
168 std::vector<std::pair<unsigned,unsigned> >& e2,
187 #define VGL_POLYGON_INSTANTIATE(T) extern "please include vgl/vgl_polygon.hxx instead" 189 #endif // vgl_polygon_h_ vgl_polygon()=default
Default constructor - constructs an empty polygon with no sheets.
a point in 2D nonhomogeneous space
bool contains(point_t const &p) const
Returns true if p(x,y) is inside the polygon, else false.
void vgl_selfintersections(vgl_polygon< T > const &p, std::vector< std::pair< unsigned, unsigned > > &e1, std::vector< std::pair< unsigned, unsigned > > &e2, std::vector< vgl_point_2d< T > > &ip)
Compute all self-intersections between all edges on all sheets.
vgl_polygon(vgl_polygon const &a)
void new_sheet()
Add a new (empty) sheet to the polygon.
std::ostream & print(std::ostream &) const
Pretty print.
vgl_polygon< T > vgl_reorient_polygon(vgl_polygon< T > const &p)
void push_back(sheet_t const &s)
Add a pre-existing sheet to the polygon.
void add_contour(point_t const p[], int n)
Add a single sheet to this polygon, specified by the given list of n points.
vgl_polygon(std::vector< sheet_t > sheets)
Construct by specifying all of its sheets.
bool vgl_polygon_sheet_is_counter_clockwise(std::vector< vgl_point_2d< T > > verts)
std::ostream & operator<<(std::ostream &s, vgl_orient_box_3d< Type > const &p)
Write box to stream.
vgl_polygon(sheet_t const &points, unsigned n_sheets=1)
Construct a single-sheet polygon from a sheet, i.e., a vector of 2D points.
A commonly required (single-sheet) polygon representation.
vgl_point_2d< T > point_t
vgl_polygon_sheet_as_array(vgl_polygon< T > const &p)
Automatic constructor from a single-sheet polygon.
void push_back(T x, T y)
Add a new point to the last sheet.
sheet_t const & operator[](int i) const
Get the ith sheet.
unsigned int num_vertices() const
vgl_polygon(unsigned int nr_sheets)
Construct an empty polygon, setting the number of (empty) sheets.
sheet_t & operator[](int i)
Get the ith sheet.
std::istream & operator>>(std::istream &is, vgl_orient_box_3d< Type > &p)
Read box from stream.
~vgl_polygon_sheet_as_array()
Destructor.
std::vector< point_t > sheet_t
unsigned int num_sheets() const
std::istream & read(std::istream &)
read this polygon from ascii stream.
std::vector< sheet_t > sheets_
void clear()
Set the number of sheets to zero, so the polygon becomes empty.