FarseerPhysics.Common.Decomposition.Triangulate.validatePolygon C# (CSharp) Method

validatePolygon() static private method

static private validatePolygon ( Vertices polygon ) : bool
polygon Vertices
return bool
		static bool validatePolygon( Vertices polygon )
		{
			var errorCode = polygon.checkPolygon();

			if( errorCode == PolygonError.InvalidAmountOfVertices || errorCode == PolygonError.AreaTooSmall || errorCode == PolygonError.SideTooSmall || errorCode == PolygonError.NotSimple )
				return false;

			if( errorCode == PolygonError.NotCounterClockWise ) //NotCounterCloseWise is the last check in CheckPolygon(), thus we don't need to call ValidatePolygon again.
				polygon.Reverse();

			if( errorCode == PolygonError.NotConvex )
			{
				polygon = GiftWrap.getConvexHull( polygon );
				return validatePolygon( polygon );
			}

			return true;
		}