Navigation
API > API/Runtime > API/Runtime/GeometryCore
TPolygon2 is a 2D polygon represented as a list of Vertices.
| Name | TPolygon2 |
| Type | class |
| Header File | /Engine/Source/Runtime/GeometryCore/Public/Polygon2.h |
| Include Path | #include "Polygon2.h" |
| Source | /Engine/Source/Runtime/GeometryCore/Public/CompGeom/Delaunay2.h |
Syntax
template<typename T>
class TPolygon2
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
| Construct polygon with given list of vertices | Polygon2.h | ||
TPolygon2 () |
Polygon2.h | ||
| Polygon2.h | |||
TPolygon2
(
TArrayView< const TVector2< T > > VertexArray, |
Construct polygon with given indices into a vertex array | Polygon2.h |
Classes
| Name | Remarks |
|---|---|
| SegmentEnumerable | Wrapper around SegmentIterator that has begin() and end() suitable for range-based for loop |
| SegmentIterator | SegmentIterator is used to iterate over the TSegment2 |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void AppendVertex
(
const TVector2< T >& Position |
Add a vertex to the Polygon | Polygon2.h | |
| Add a list of Vertices to the Polygon | Polygon2.h | ||
T Area() |
Polygon2.h | ||
T AverageEdgeLength() |
Polygon2.h | ||
TAxisAlignedBox2< T > Bounds() |
Polygon2.h | ||
void Chamfer
(
T ChamferDist, |
Chamfer each vertex corner of the Polygon | Polygon2.h | |
void ClipConvex
(
const TAxisAlignedBox2< T >& Bounds |
Clip polygon to the given bounds. | Polygon2.h | |
| Polygon2.h | |||
| Polygon2.h | |||
| Polygon2.h | |||
T DistanceSquared
(
const TVector2< T >& QueryPoint, |
Calculate the squared distance from a point to the polygon | Polygon2.h | |
T DistanceSquared
(
const TVector2< T >& QueryPoint |
Calculate the squared distance from a point to the polygon | Polygon2.h | |
| Find all the points where an edge of the Polygon intersects an edge of the OtherPolygon | Polygon2.h | ||
| Polygon2.h | |||
| 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 | Polygon2.h | ||
TVector2< T > GetNormal_FaceAvg
(
int VertexIndex |
Construct a normal at a vertex of the Polygon by averaging the adjacent face normals. | Polygon2.h | |
TVector2< T > GetSegmentPoint
(
int SegmentIndex, |
Polygon2.h | ||
TVector2< T > GetSegmentPointUnitParam
(
int SegmentIndex, |
Polygon2.h | ||
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 | Polygon2.h | |
| Polygon2.h | |||
bool Intersects
(
const TPolygon2< T >& OtherPoly |
Polygon2.h | ||
bool Intersects
(
const TSegment2< T >& Segment |
Polygon2.h | ||
bool IsClockwise() |
Polygon2.h | ||
bool IsConvex
(
T RadiansTolerance, |
Polygon2.h | ||
| Get the previous and next vertex positions for a given vertex of the Polygon | Polygon2.h | ||
| Get the vectors from a given vertex to the previous and next Vertices, optionally normalized | Polygon2.h | ||
T OpeningAngleDeg
(
int iVertex |
Polygon2.h | ||
| Check for polygon overlap, aka solid intersection. | Polygon2.h | ||
T Perimeter() |
Polygon2.h | ||
void PolyOffset
(
T OffsetDistance |
Offset polygon by fixed distance, by offsetting and intersecting edges. | Polygon2.h | |
void RemoveVertex
(
int VertexIndex |
Remove a vertex of the Polygon (existing Vertices are shifted) | Polygon2.h | |
void Reverse() |
Reverse the order of the Vertices in the Polygon (ie switch between Clockwise and CounterClockwise) | Polygon2.h | |
| Scale the Polygon relative to a given point | Polygon2.h | ||
TSegment2< T > Segment
(
int SegmentIndex |
Polygon2.h | ||
SegmentIterator SegmentItr() |
Polygon2.h | ||
SegmentEnumerable Segments() |
Polygon2.h | ||
void Set
(
int VertexIndex, |
Set vertex at given index to a new Position | Polygon2.h | |
| Replace the list of Vertices with a new list | Polygon2.h | ||
T SignedArea() |
Polygon2.h | ||
void Simplify
(
T ClusterTolerance, |
Simplify the Polygon to reduce the vertex count | Polygon2.h | |
const TVector2< T > & Start() |
Polygon2.h | ||
| Apply an arbitrary transformation to the Polygon | Polygon2.h | ||
| Translate the polygon | Polygon2.h | ||
int VertexCount() |
Polygon2.h | ||
void VtxNormalOffset
(
T OffsetDistance, |
Offset each point by the given Distance along vertex "normal" direction | Polygon2.h | |
T WindingIntegral
(
const TVector2< T >& QueryPoint |
Polygon2.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static TPolygon2< T > MakeCircle
(
T Radius, |
Construct a circular polygon | Polygon2.h | |
| Construct a four-vertex rectangle polygon | Polygon2.h | ||
| Construct a rounded rectangle polygon | Polygon2.h | ||
static void SimplifyDouglasPeucker
(
T Tolerance, |
Polygon simplification code adapted from: http://softsurfer.com/Archive/algorithm_0205/algorithm_0205.htm simplifyDP(): This is the Douglas-Peucker recursive simplification routine It just marks Vertices that are part of the simplified polyline for approximating the polyline subchain v[j] to v[k]. | Polygon2.h |
Operators
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
const TVector2< T > & operator[]
(
int Index |
Get the vertex at a given index | Polygon2.h | |
TVector2< T > & operator[]
(
int Index |
Get the vertex at a given index | Polygon2.h |