# Class Polygon

Public

Utility functions for working with polygons, lines, and other vector math.

All functions which accepts Vector3s but work in 2D space uses the XZ space if nothing else is said.

### Version

A lot of functions in this class have been moved to the VectorMath class the names have changed slightly and everything now consistently assumes a left handed coordinate system now instead of sometimes using a left handed one and sometimes using a right handed one. This is why the 'Left' methods redirect to methods named 'Right'. The functionality is exactly the same.

## Public Static Methods

ClosestPointOnTriangle (a, b, c, p)

Closest point on the triangle abc to the point p.

Public Static
ClosestPointOnTriangle (a, b, c, p)

Closest point on the triangle abc to the point p.

Public Static
ClosestPointOnTriangleXZ (a, b, c, p)

Closest point on the triangle abc to the point p when seen from above.

Public Static
CompressMesh (vertices, triangles, outVertices, outTriangles)

Compress the mesh by removing duplicate vertices.

Public Static
ContainsPoint (polyPoints, p)

Checks if p is inside the polygon.

Public Static
ContainsPoint (a, b, c, p)

Returns if the triangle ABC contains the point p.

Public Static
ContainsPointXZ (polyPoints, p)

Checks if p is inside the polygon (XZ space).

Public Static
ContainsPointXZ (a, b, c, p)

Returns if the triangle ABC contains the point p.

Public Static
ContainsPointXZ (a, b, c, p)

Returns if the triangle ABC contains the point p in XZ space.

Public Static
ConvexHullXZ (points)

Calculates convex hull in XZ space for the points.

Public Static
SampleYCoordinateInTriangle (p1, p2, p3, p)

Sample Y coordinate of the triangle (p1, p2, p3) at the point p in XZ space.

Public Static
Subdivide (points, result, subSegments)

Divides each segment in the list into subSegments segments and fills the result list with the new points.

Public Static
TraceContours (outline, hasInEdge, results)

Given a set of edges between vertices, follows those edges and returns them as chains and cycles.

Public Static

## Private/Protected Members

cached_Int3_int_dict

Cached dictionary to avoid excessive allocations.

Private Static Readonly