## Types in MathNet.Spatial.Euclidean

Type Polygon2D

Namespace MathNet.Spatial.Euclidean

Interfaces IEquatable<Polygon2D>, IXmlSerializable

Class to represent a closed polygon.

### Public Constructors

#### Polygon2D(IEnumerable<Point2D> vertices)

Initializes a new instance of the Polygon2D class. At least three points are needed to construct a polygon. If less are passed an ArgumentException is thrown.
##### Parameters
###### `IEnumerable<Point2D>` vertices

A list of vertices.

#### Polygon2D(Point2D[] vertices)

Initializes a new instance of the Polygon2D class. At least three points are needed to construct a polygon. If less are passed an ArgumentException is thrown.
##### Parameters
###### `Point2D[]` vertices

A list of vertices.

### Public Static Functions

#### boolArePolygonVerticesColliding(Polygon2D a, Polygon2D b)

Compute whether or not two polygons are colliding based on whether or not the vertices of either are enclosed within the shape of the other. This is a simple means of detecting collisions that can fail if the two polygons are heavily overlapped in such a way that one protrudes through the other and out its opposing side without any vertices being enclosed.
##### Parameters
###### `Polygon2D` a

The first polygon.

###### `Polygon2D` b

The second polygon

##### Return
###### `bool`

True if the vertices collide; otherwise false.

#### Polygon2DGetConvexHullFromPoints(IEnumerable<Point2D> pointList, bool clockWise)

Using algorithm from Ouellet - https://www.codeproject.com/Articles/1210225/Fast-and-improved-D-Convex-Hull-algorithm-and-its, take an IEnumerable of Point2Ds and computes the two dimensional convex hull, returning it as a Polygon2D object.
##### Parameters

A list of points

###### `bool` clockWise

In which direction to return the points on the convex hull. If true, clockwise. Otherwise counter clockwise

A polygon.

### Public Methods

#### boolEnclosesPoint(Point2D p)

Test whether a point is enclosed within a polygon. Points on the polygon edges are not counted as contained within the polygon.

A point.

##### Return
###### `bool`

True if the point is inside the polygon; otherwise false.

#### boolEquals(Polygon2D other, double tolerance)

Returns a value to indicate if a pair of polygons are equal
##### Parameters
###### `Polygon2D` other

The polygon to compare against.

###### `double` tolerance

A tolerance (epsilon) to adjust for floating point error

##### Return
###### `bool`

true if the polygons are equal; otherwise false

#### Polygon2DReduceComplexity(double singleStepTolerance)

Creates a new polygon from the existing polygon by removing any edges whose adjacent segments are considered colinear within the provided tolerance
##### Parameters
###### `double` singleStepTolerance

The tolerance by which adjacent edges should be considered collinear.

A polygon

#### Polygon2DRotate(Angle angle)

Returns a polygon rotated around the origin
##### Parameters
###### `Angle` angle

The angle by which to rotate.

##### Return
###### `Polygon2D`

A new polygon that has been rotated.

#### Polygon2DRotateAround(Angle angle, Point2D center)

Rotate the polygon around the specified point
##### Parameters
###### `Angle` angle

The angle by which to rotate

###### `Point2D` center

A point at which to rotate around

##### Return
###### `Polygon2D`

A new polygon that has been rotated.

#### PolyLine2DToPolyLine2D()

Converts the polygon into a PolyLine2D

A polyline

#### Polygon2DTranslateBy(Vector2D vector)

Returns a new polygon which is translated (moved) by a vector

A vector.

##### Return
###### `Polygon2D`

A new polygon that has been translated.

### Public Properties

#### IEnumerable<LineSegment2D>Edges get;

Gets a list of Edges

#### intVertexCount get;

Gets the number of vertices in the polygon.

#### IEnumerable<Point2D>Vertices get;

Gets a list of vertices