Navigation
API > API/Runtime > API/Runtime/GeometryCore
References
| Module | GeometryCore |
| Header | /Engine/Source/Runtime/GeometryCore/Public/Polygon2.h |
| Include | #include "Polygon2.h" |
Syntax
template<typename T>
class TPolygon2
Remarks
TPolygon2 is a 2D polygon represented as a list of Vertices.
Variables
Constructors
| Type | Name | Description | |
|---|---|---|---|
TPolygon2 () |
|||
| Construct polygon with given list of vertices | |||
TPolygon2
(
TArrayView< const TVector2< T >> VertexArray, |
Construct polygon with given indices into a vertex array |
Functions
| Type | Name | Description | |
|---|---|---|---|
| void | AppendVertex
(
const TVector2< T >& Position |
Add a vertex to the Polygon | |
| void | AppendVertices
(
const TArray< TVector2< T >>& NewVertices |
Add a list of Vertices to the Polygon | |
| T | Area () |
||
| T | |||
| TAxisAlignedBox2< T > | Bounds () |
||
| void | Chamfer
(
T ChamferDist, |
Chamfer each vertex corner of the Polygon | |
| void | ClipConvex
(
const TAxisAlignedBox2< T >& Bounds |
Clip polygon to the given bounds. | |
| bool | |||
| bool | |||
| bool | |||
| T | DistanceSquared
(
const TVector2< T >& QueryPoint, |
Calculate the squared distance from a point to the polygon | |
| T | DistanceSquared
(
const TVector2< T >& QueryPoint |
Calculate the squared distance from a point to the polygon | |
| bool | FindIntersections
(
const TPolygon2< T >& OtherPoly, |
Find all the points where an edge of the Polygon intersects an edge of the OtherPolygon | |
| TVector2< T > | GetNormal
(
int iSeg, |
||
| TVector2< T > | GetNormal
(
int VertexIndex |
Get the normal vector at a vertex of the polygon, which is perpendicular to GetTangent() Points "inward" for a Clockwise Polygon, and outward for CounterClockwise | |
| TVector2< T > | GetNormal_FaceAvg
(
int VertexIndex |
Construct a normal at a vertex of the Polygon by averaging the adjacent face normals. | |
| TVector2< T > | GetSegmentPoint
(
int SegmentIndex, |
||
| TVector2< T > | GetSegmentPointUnitParam
(
int SegmentIndex, |
||
| TVector2< T > | GetTangent
(
int VertexIndex |
Get the tangent vector at a vertex of the polygon, which is the normalized vector from the previous vertex to the next vertex | |
| const TArray< TVector2< T > > & | GetVertices () |
||
| bool | Intersects
(
const TPolygon2< T >& OtherPoly |
||
| bool | Intersects
(
const TSegment2< T >& Segment |
||
| bool | IsClockwise () |
||
| bool | IsConvex
(
T RadiansTolerance, |
||
| TPolygon2< T > | MakeCircle
(
T Radius, |
Construct a circular polygon | |
| TPolygon2< T > | MakeRectangle
(
const TVector2< T >& Center, |
Construct a four-vertex rectangle polygon | |
| TPolygon2< T > | MakeRoundedRectangle
(
const TVector2< T >& Center, |
Construct a rounded rectangle polygon | |
| void | NeighbourPoints
(
int VertexIdx, |
Get the previous and next vertex positions for a given vertex of the Polygon | |
| void | NeighbourVectors
(
int VertexIdx, |
Get the vectors from a given vertex to the previous and next Vertices, optionally normalized | |
| T | OpeningAngleDeg
(
int iVertex |
||
| bool | Check for polygon overlap, aka solid intersection. | ||
| T | Perimeter () |
||
| void | PolyOffset
(
T OffsetDistance |
Offset polygon by fixed distance, by offsetting and intersecting edges. | |
| void | RemoveVertex
(
int VertexIndex |
Remove a vertex of the Polygon (existing Vertices are shifted) | |
| void | Reverse () |
Reverse the order of the Vertices in the Polygon (ie switch between Clockwise and CounterClockwise) | |
| TPolygon2< T > & | Scale the Polygon relative to a given point | ||
| TSegment2< T > | Segment
(
int SegmentIndex |
||
| SegmentIterator | SegmentItr () |
||
| SegmentEnumerable | Segments () |
||
| void | Set vertex at given index to a new Position | ||
| void | SetVertices
(
const TArray< TVector2< T >>& NewVertices |
Replace the list of Vertices with a new list | |
| T | SignedArea () |
||
| void | Simplify
(
T ClusterTolerance, |
Simplify the Polygon to reduce the vertex count | |
| const TVector2< T > & | Start () |
||
| TPolygon2< T > & | Apply an arbitrary transformation to the Polygon | ||
| TPolygon2< T > & | Translate the polygon | ||
| int | VertexCount () |
||
| void | VtxNormalOffset
(
T OffsetDistance, |
Offset each point by the given Distance along vertex "normal" direction | |
| T | WindingIntegral
(
const TVector2< T >& QueryPoint |
Operators
| Type | Name | Description | |
|---|---|---|---|
| const TVector2< T > & | operator[]
(
int Index |
Get the vertex at a given index | |
| TVector2< T > & | operator[]
(
int Index |
Get the vertex at a given index |
Classes
| Type | Name | Description | |
|---|---|---|---|
| SegmentEnumerable | Wrapper around SegmentIterator that has begin() and end() suitable for range-based for loop | ||
| SegmentIterator | SegmentIterator is used to iterate over the TSegment2 |