typedef
Polygon_2::Vertex_iterator VertexIterator;
typedef
Polygon_2::Edge_const_iterator EdgeIterator;
int
main()
Polygon_2 p;
p.push_back(Point(4,0));
p.push_back(Point(4,4));
p.push_back(Point(2,2));
p.push_back(Point(0,4));
std::cout <<
"created the polygon p:"
<< std::endl;
std::cout << p << std::endl;
std::cout << std::endl;
bool
IsSimple = p.is_simple();
bool
IsConvex = p.is_convex();
double
Area = p.area();
std::cout <<
"polygon p is"
;
if
(!IsSimple) std::cout <<
" not"
;
std::cout <<
" simple."
<< std::endl;
std::cout <<
"polygon p is"
;
if
(!IsConvex) std::cout <<
" not"
;
std::cout <<
" convex."
<< std::endl;
std::cout <<
"polygon p is"
;
if
(!IsClockwise) std::cout <<
" not"
;
std::cout <<
" clockwise oriented."
<< std::endl;
std::cout <<
"the area of polygon p is "
<< Area << std::endl;
std::cout << std::endl;
Point q(1,1);
std::cout <<
"created point q = "
<< q << std::endl;
std::cout << std::endl;
std::cout <<
"point q is"
;
if
(!IsInside) std::cout <<
" not"
;
std::cout <<
" inside polygon p."
<< std::endl;
std::cout << std::endl;
int
n=0;
for
(VertexIterator vi = p.vertices_begin(); vi != p.vertices_end(); ++vi)
std::cout <<
"vertex "
<< n++ <<
" = "
<< *vi << std::endl;
std::cout << std::endl;
for
(EdgeIterator ei = p.edges_begin(); ei != p.edges_end(); ++ei)
std::cout <<
"edge "
<< n++ <<
" = "
<< *ei << std::endl;
return
0;
The class Polygon_2 implements polygons.
Definition:
Polygon_2.h:65
void push_back(const Point_2 &x)
Has the same semantics as p.insert(p.vertices_end(), q).
Definition:
Polygon_2.h:226
Mode set_pretty_mode(std::ios &s)
const CGAL::Orientation CLOCKWISE