Navigation
API > API/Plugins > API/Plugins/DynamicMesh
Implementation of Garland & Heckbert Quadric Error Metric (QEM) Triangle Mesh Simplification
| Name | TMeshSimplification |
| Type | class |
| Header File | /Engine/Plugins/Runtime/GeometryProcessing/Source/DynamicMesh/Public/MeshSimplification.h |
| Include Path | #include "MeshSimplification.h" |
Syntax
template<typename QuadricErrorType>
class TMeshSimplification : public UE::Geometry::FMeshRefinerBase
Inheritance Hierarchy
- FMeshRefinerBaseFixLayout → FMeshRefinerBase → TMeshSimplification
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
| MeshSimplification.h | |||
TMeshSimplification
(
FDynamicMesh3* m |
MeshSimplification.h |
Structs
| Name | Remarks |
|---|---|
| FCollapseInfo | Optional additional info to support edge collapses in more configurations i.e. for tri ABC, if edge AB is not constrained, but AC and BC are, it is sometimes safe to collapse AB if we also remove constraints from vertex B and edges B(AC) after the collapse. |
| FEdgeError | |
| QEdge | Internal class for priority queue |
Enums
Public
| Name | Remarks |
|---|---|
| EGeometricErrorCriteria | Ways to measure geometric error |
| ESimplificationCollapseModes |
Protected
| Name | Remarks |
|---|---|
| ETargetModes |
Typedefs
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| FQuadricErrorType | QuadricErrorType | MeshSimplification.h | |
| FQuadricOptions | TQuadricOptionsHelper< QuadricErrorType >::FOptions | MeshSimplification.h | |
| FSeamQuadricType | TQuadricError< RealType > | MeshSimplification.h | |
| RealType | FQuadricErrorType::ScalarType | MeshSimplification.h |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| bAllowSeamCollapse | bool | If true, we allow UV and Normal seams to collapse during simplification. | MeshSimplification.h | |
| bLimitConstrainedSeamMovement | bool | If true, we prevent collapses that would move edge midpoints away from their constraint target by more than the edge constraint's threshold distance (if any) | MeshSimplification.h | |
| bPreserveBoundaryShape | bool | If true, we try to keep boundary vertices on boundary. | MeshSimplification.h | |
| bPreventTinyTriangles | bool | Controls whether we disallow creation of triangles with small areas inside edge operations. | MeshSimplification.h | |
| bRetainQuadricMemory | bool | If false, face and vertex quadrics are recomputed in the neighborhood of each collapse, definitely slower but maybe higher quality | MeshSimplification.h | |
| CollapseMode | ESimplificationCollapseModes | Controls the method used when selecting the position the results from an edge collapse. | MeshSimplification.h | |
| CustomEdgeLengthScaleF | TFunction< double(const FDynamicMesh3 &, int VertexA, int VertexB)> | MeshSimplification.h | ||
| CustomGeometricErrorScaleF | TFunction< double(const FDynamicMesh3 &, int VertexA, int VertexB)> | Custom scales to apply to measured errors and edge lengths. Note this is in effect the inverse of scaling the tolerances / target lengths. | MeshSimplification.h | |
| CustomQuadricErrorScaleF | TFunction< double(const FDynamicMesh3 &, int Vertex)> | Custom per-vertex quadric error scaling. Values should be greater than zero. | MeshSimplification.h | |
| GeometricErrorConstraint | EGeometricErrorCriteria | Geometric error measurement/check to perform before allowing an edge collapse | MeshSimplification.h | |
| GeometricErrorTolerance | double | Tolerance to use in geometric error checking | MeshSimplification.h | |
| GroupBoundaryConstraint | EEdgeRefineFlags | MeshSimplification.h | ||
| MaterialBoundaryConstraint | EEdgeRefineFlags | MeshSimplification.h | ||
| MaxResultTriangleCount | int32 | If > 0, this is an absolute upper bound on the result triangle count: while the mesh has more triangles than this, the simplifier bypasses its stopping criteria (geometric error tolerance, edge-too-long rejection in SimplifyToEdgeLength, and the SimplifyToMaxError loop break) and keeps collapsing. | MeshSimplification.h | |
| MeshBoundaryConstraint | EEdgeRefineFlags | When using the constraint system, these options will apply to the appropriate boundaries. | MeshSimplification.h | |
| QuadricOptions | FQuadricOptions | MeshSimplification.h | ||
| RegularizeMethod | ERegularizeSimplificationMethod | Method to use to regularize, if RegularizeWeight > 0 | MeshSimplification.h | |
| RegularizeWeight | double | If greater than 0, we will add a regularization term with this weight. | MeshSimplification.h |
Functions
Public
Public Virtual
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void FastCollapsePass
(
double MinEdgeLength, |
Does N rounds of collapsing edges longer than fMinEdgeLength. | MeshSimplification.h | |
virtual void SimplifyToEdgeLength
(
double MinEdgeLength |
Simplify mesh until no edges smaller than min length remain. This is not a great criteria. | MeshSimplification.h | |
virtual void SimplifyToMaxError
(
double MaxError |
Simplify mesh until the quadric error of an edge collapse exceeds the specified criteria. | MeshSimplification.h | |
virtual void SimplifyToMinimalPlanar
(
double CoplanarAngleTolDeg, |
Maximally collapse mesh in a way that does not change shape at all. | MeshSimplification.h | |
virtual void SimplifyToTriangleCount
(
int TriangleCount |
Simplify mesh until we reach a specific triangle count, unless geometric error criterion stops the decimation earlier. | MeshSimplification.h | |
virtual void SimplifyToVertexCount
(
int VertexCount |
Simplify mesh until it has a specific vertex count | MeshSimplification.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FQuadricErrorType AssembleEdgeQuadric
(
const FDynamicMesh3::FEdge& edge |
Uses pre-computed vertex, face and seam quadrics to construct the edge quadric. | MeshSimplification.h | |
bool CanCollapseEdge
(
int edgeID, |
Figure out if we can collapse edge eid=[a,b] under current constraint set Similar to the base class FMeshRefinerBase::CanCollapseEdge, but with simplifier-specific modifications (some more flexibility and restrictions depending on CollapseMode) | MeshSimplification.h | |
bool CheckIfCollapseWithinEdgeConstraintsTolerance
(
int VKeep, |
Check if edge collapse would violate edge constraint tolerance | MeshSimplification.h | |
bool CheckIfCollapseWithinGeometricTolerance
(
int vid, |
Check if edge collapse would violate geometric error criteria | MeshSimplification.h | |
ESimplificationResult CollapseEdge
(
int edgeID, |
Collapse given edge. | MeshSimplification.h | |
FQuadricErrorType ComputeFaceQuadric
(
const int tid, |
MeshSimplification.h | ||
bool EnableInlineProjection() |
This just lets us write more concise code | MeshSimplification.h | |
FVector3d GetProjectedPoint
(
const FVector3d& pos |
MeshSimplification.h | ||
bool IsBoundaryVertex
(
int vid |
MeshSimplification.h | ||
FQuadricErrorType MergeVertexQuadricsToEdgeQuadric
(
const FDynamicMesh3::FEdge& edge |
MeshSimplification.h | ||
FVector3d OptimalPoint
(
int eid, |
Return point that minimizes quadric error for edge [ea,eb] | MeshSimplification.h | |
void Precompute
(
bool bMeshIsClosed |
MeshSimplification.h | ||
bool RegularizeUsesNormals() |
MeshSimplification.h | ||
bool RemoveIsolatedTriangle
(
int tID |
Remove an isolated triangle. | MeshSimplification.h | |
bool ShouldIgnoreStoppingCriteria () |
Returns true while the mesh is still above MaxResultTriangleCount and we should therefore override stopping criteria (geometric error, edge-too-long, max-error loop break) to keep collapsing. | MeshSimplification.h | |
void UpdateVertexAttributes
(
int edgeID, |
MeshSimplification.h |
Protected Virtual
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void ApplyToProjectVertices
(
const TFunction< void(int)>& apply_f |
MeshSimplification.h | ||
virtual void DoSimplify() |
Top-level function that does the simplification | MeshSimplification.h | |
virtual void FullProjectionPass() |
Project vertices onto projection target. | MeshSimplification.h | |
virtual int GetNextEdge
(
int CurEdgeID, |
MeshSimplification.h | ||
virtual FVector3d GetProjectedCollapsePosition
(
int vid, |
Used by collapse-edge to get projected position for new vertex | MeshSimplification.h | |
virtual void InitializeQueue() |
MeshSimplification.h | ||
virtual void InitializeSeamQuadrics() |
MeshSimplification.h | ||
virtual void InitializeTriQuadrics() |
MeshSimplification.h | ||
virtual void InitializeVertexQuadrics() |
MeshSimplification.h | ||
virtual void OnEdgeCollapse
(
int edgeID, |
Subclasses can override this to implement custom behavior... | MeshSimplification.h | |
virtual void OnRemoveIsolatedTriangle
(
int tId |
Subclasses can override this to implement custom behavior... | MeshSimplification.h | |
virtual void ProfileBeginCollapse() |
MeshSimplification.h | ||
virtual void ProfileBeginOps() |
MeshSimplification.h | ||
virtual void ProfileBeginPass() |
MeshSimplification.h | ||
virtual void ProfileBeginProject() |
MeshSimplification.h | ||
virtual void ProfileBeginSetup() |
MeshSimplification.h | ||
virtual void ProfileEndCollapse() |
MeshSimplification.h | ||
virtual void ProfileEndOps() |
MeshSimplification.h | ||
virtual void ProfileEndPass() |
MeshSimplification.h | ||
virtual void ProfileEndProject() |
MeshSimplification.h | ||
virtual void ProfileEndSetup() |
MeshSimplification.h | ||
virtual void ProjectVertex
(
int vID, |
MeshSimplification.h | ||
virtual void Reproject() |
MeshSimplification.h | ||
virtual int StartEdges() |
MeshSimplification.h | ||
virtual void UpdateNeighborhood
(
const FDynamicMesh3::FEdgeCollapseInfo& collapseInfo |
Update queue weight for each edge in vertex one-ring and rebuild and quadrics necessary | MeshSimplification.h |