UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
UE::Geometry::FLocalPlanarSimplify Class Reference

#include <LocalPlanarSimplify.h>

Public Member Functions

GEOMETRYCORE_API void SimplifyAlongEdges (FDynamicMesh3 &Mesh, TSet< int32 > &InOutEdges, TUniqueFunction< void(const DynamicMeshInfo::FEdgeCollapseInfo &)> ProcessCollapse=nullptr) const
 

Static Public Member Functions

static GEOMETRYCORE_API void CollapseDegenerateEdges (FDynamicMesh3 &Mesh, TSet< int32 > &InOutEdges, bool bRemoveAllDegenerateFromInputSet=false, double DegenerateEdgeLenTol=UE_DOUBLE_SMALL_NUMBER, TSet< int > *TriangleSelection=nullptr)
 
static GEOMETRYCORE_API bool IsFlat (const FDynamicMesh3 &Mesh, int VID, double DotTolerance, FVector3d &OutFirstNormal)
 
static GEOMETRYCORE_API bool IsDevelopableAlongEdge (const FDynamicMesh3 &Mesh, int EID, int VID, double DotTolerance, FVector3d &NormalA, bool &bIsFlat)
 
static GEOMETRYCORE_API bool CollapseWouldHurtTriangleQuality (const FDynamicMesh3 &Mesh, const FVector3d &RemoveVNormal, int32 RemoveV, const FVector3d &RemoveVPos, int32 KeepV, const FVector3d &KeepVPos, double TryToImproveTriQualityThreshold, bool bHasMultipleNormals=false)
 
static GEOMETRYCORE_API bool CollapseWouldChangeShapeOrUVs (const FDynamicMesh3 &Mesh, const TSet< int > &PathEdgeSet, double DotTolerance, int SourceEID, int32 RemoveV, const FVector3d &RemoveVPos, int32 KeepV, const FVector3d &KeepVPos, const FVector3d &EdgeDir, bool bPreserveTriangleGroups, bool bPreserveUVsForMesh, bool bPreserveVertexUVs, bool bPreserveOverlayUVs, float UVToleranceSq, bool bPreserveVertexNormals, float NormalEqualCosThreshold)
 

Public Attributes

double SimplificationAngleTolerance = .1
 
double TryToImproveTriQualityThreshold = .25
 
bool bPreserveTriangleGroups = true
 
bool bPreserveVertexUVs = true
 
bool bPreserveOverlayUVs = true
 
float UVDistortTolerance = FMathf::ZeroTolerance
 
bool bPreserveVertexNormals = true
 
float NormalDistortTolerance = .01f
 

Member Function Documentation

◆ CollapseDegenerateEdges()

void FLocalPlanarSimplify::CollapseDegenerateEdges ( FDynamicMesh3 Mesh,
TSet< int32 > &  InOutEdges,
bool  bRemoveAllDegenerateFromInputSet = false,
double  DegenerateEdgeLenTol = UE_DOUBLE_SMALL_NUMBER,
TSet< int > *  TriangleSelection = nullptr 
)
static

Collapse degenerate edges. Note that SimplifyAlongEdges currently assumes that this (or a similar pass) is run beforehand

Parameters
MeshMesh to repair
InOutEdgesSet of edges to consider for collapse; optionally updated by removing edges at they are collapsed
bRemoveAllDegenerateFromInputSetWhether we should also check whether the neighbor edges removed by collapse were also in the set. Note: Often not needed, and has additional processing cost.
DegenerateEdgeLenTolTolerance length at which we collapse edges
TriangleSelectionOptional set tracking an active selection. Any triangles removed by collapse will also be removed from the set.

◆ CollapseWouldChangeShapeOrUVs()

bool FLocalPlanarSimplify::CollapseWouldChangeShapeOrUVs ( const FDynamicMesh3 Mesh,
const TSet< int > &  PathEdgeSet,
double  DotTolerance,
int  SourceEID,
int32  RemoveV,
const FVector3d RemoveVPos,
int32  KeepV,
const FVector3d KeepVPos,
const FVector3d EdgeDir,
bool  bPreserveTriangleGroups,
bool  bPreserveUVsForMesh,
bool  bPreserveVertexUVs,
bool  bPreserveOverlayUVs,
float  UVEqualThresholdSq,
bool  bPreserveVertexNormals,
float  NormalEqualCosThreshold 
)
static

Test if a given edge collapse would change the mesh shape, mesh triangle group shape, or UVs unacceptably

Test if a given edge collapse would change the mesh shape or UVs unacceptably

◆ CollapseWouldHurtTriangleQuality()

bool FLocalPlanarSimplify::CollapseWouldHurtTriangleQuality ( const FDynamicMesh3 Mesh,
const FVector3d RemoveVNormal,
int32  RemoveV,
const FVector3d RemoveVPos,
int32  KeepV,
const FVector3d KeepVPos,
double  TryToImproveTriQualityThreshold,
bool  bHasMultipleNormals = false 
)
static

Test if a given edge collapse would cause a triangle flip or other unacceptable decrease in mesh quality Specialized for collapsing at flat triangles

Parameters
MeshThe mesh to query
RemoveVNormalOnly used if bHasMultipleNormals==false, i.e. if the surface is locally flat, to avoid recomputing the normal. The normal for all triangles surrounding RemoveV.
RemoveVThe vertex to consider removing by an edge collapse
RemoveVPosThe position of the vertex RemoveV
KeepVThe vertex that is not being removed in the edge collapse
KeepVPosThe position of vertex KeepV
TryToImproveTriQualityThresholdThreshold for triangle quality (see comment for class member, above)
bHasMultipleNormalsIf false, assume the triangulation is locally flat, so we can use ExpectNormal instead of recomputing the expected normal

Test if a given edge collapse would cause a triangle flip or other unacceptable decrease in mesh quality

◆ IsDevelopableAlongEdge()

bool FLocalPlanarSimplify::IsDevelopableAlongEdge ( const FDynamicMesh3 Mesh,
int  EID,
int  VID,
double  DotTolerance,
FVector3d NormalA,
bool bIsFlat 
)
static

Test if the triangles connected to a vertex could be flattened by folding along the given edge

Parameters
MeshThe mesh to query
EIDThe edge around which the triangles are allowed to fold
VIDThe vertex to query
DotToleranceIf the dot product of two normals are >= this tolerance, the normals are considered equivalent
Thenormal of the first triangle attached to the vertex.
Returns
Whether all the triangles were coplanar

◆ IsFlat()

bool FLocalPlanarSimplify::IsFlat ( const FDynamicMesh3 Mesh,
int  VID,
double  DotTolerance,
FVector3d OutFirstNormal 
)
static

Test if the triangles connected to a vertex are all coplanar

Parameters
MeshThe mesh to query
VIDThe vertex to query
DotToleranceIf the dot product of two normals are >= this tolerance, the normals are considered equivalent
Thenormal of the first triangle attached to the vertex.
Returns
Whether all the triangles were coplanar

◆ SimplifyAlongEdges()

void FLocalPlanarSimplify::SimplifyAlongEdges ( FDynamicMesh3 Mesh,
TSet< int32 > &  InOutEdges,
TUniqueFunction< void(const DynamicMeshInfo::FEdgeCollapseInfo &)>  ProcessCollapse = nullptr 
) const

Simplify Mesh along the given edges, and update the edge set accordingly

Parameters
MeshMesh to simplify
InOutEdgesEdges to simplify along – will be updated to remove any edges that have been collapsed by simplification
ProcessCollapseOptional function to be called whenever the simplification collapses an edge

Member Data Documentation

◆ bPreserveOverlayUVs

bool UE::Geometry::FLocalPlanarSimplify::bPreserveOverlayUVs = true

Prevent simplification from distorting overlay UVs

◆ bPreserveTriangleGroups

bool UE::Geometry::FLocalPlanarSimplify::bPreserveTriangleGroups = true

Prevent simplification from distorting triangle groups

◆ bPreserveVertexNormals

bool UE::Geometry::FLocalPlanarSimplify::bPreserveVertexNormals = true

Prevent simplification from distorting vertex normals

◆ bPreserveVertexUVs

bool UE::Geometry::FLocalPlanarSimplify::bPreserveVertexUVs = true

Prevent simplification from distorting vertex UVs

◆ NormalDistortTolerance

float UE::Geometry::FLocalPlanarSimplify::NormalDistortTolerance = .01f

When preserving normals, sets maximum allowed change in normals from collapsing an edge, measured at the removed vertex in degrees

◆ SimplificationAngleTolerance

double UE::Geometry::FLocalPlanarSimplify::SimplificationAngleTolerance = .1

Degrees of deviation from coplanar that we will still simplify

◆ TryToImproveTriQualityThreshold

double UE::Geometry::FLocalPlanarSimplify::TryToImproveTriQualityThreshold = .25

If triangle quality (aspect ratio) is worse than this threshold, only simplify in ways that improve quality. If <= 0, triangle quality is ignored. Note: For aspect ratio we use definition: 4*TriArea / (sqrt(3)*MaxEdgeLen^2), ref: https://people.eecs.berkeley.edu/~jrs/papers/elemj.pdf p.53 Equilateral triangles have value 1; Smaller values -> lower quality

◆ UVDistortTolerance

float UE::Geometry::FLocalPlanarSimplify::UVDistortTolerance = FMathf::ZeroTolerance

When preserving UVs, sets maximum allowed change in UV coordinates from collapsing an edge, measured at the removed vertex


The documentation for this class was generated from the following files: