## polygon

A polygon is especified by its list of vertices. In the future we might have polygonal curves, so maybe it would be a good idea to implement polygons as closed polygonal curves.

Example: the triangle with vertices (0,0), (0,1) and (1,1) would be:

<polygon id="pol"> <list_of_vertices_coordinates> <homogeneous_coordinates> <double>0</double> <double>0</double> <double>1</double> </homogeneous_coordinates> <homogeneous_coordinates> <double>0</double> <double>1</double> <double>1</double> </homogeneous_coordinates> <homogeneous_coordinates> <double>1</double> <double>1</double> <double>1</double> </homogeneous_coordinates> </list_of_vertices_coordinates> <polygon>

Note: the vertices coordinates are within a list, as opposed to directly within the polygon tag, so that the number of elements in constraints is not variable.

## Related pages and discussion in progress

More possible constraints related to polygons:

- point_on_polygon?
- point_in_polygon?
- in the wishlist it was asked a center_of_polygon (or should it be "centroid"?)
- area
- perimeter

side_of_polygon ( line_segment s, polygon pol, int i ) returns the polygon side going from vertex i to vertex i+1.

It was suggested to have a second constructor: *Constructor2: regular_polygon( point vertex1, point vertex2, integer n )
generates a regular polygon with n sides whose first vertex is point1,
the second is point2, and the other are generated rotating to the left;
that is, the vertices are oriented so that they go over the circumscribed
circle in the positive direction.* However, the resulting polygon would depend on the geometry used (euclidean, hyperbolic, elliptic, etc) so it was decided to think more about how to solve this.

In http://svn.activemath.org/intergeo/Drafts/Format/design_decisions.pdf it was decided not to impose restrictions on the vertices of polygons, so that degenerate cases are valid: three points can be on a line, a point may be repeated, sides can intersect, and the polygon border does not have to be a simple closed curve.

## Examples