TMeshSimplification

Implementation of Garland & Heckbert Quadric Error Metric (QEM) Triangle Mesh Simplification

Windows
MacOS
Linux

Inheritance Hierarchy

FMeshRefinerBase

TMeshSimplification

References

Module

DynamicMesh

Header

/Engine/Plugins/Experimental/GeometryProcessing/Source/DynamicMesh/Public/MeshSimplification.h

Include

#include "MeshSimplification.h"

Syntax

template<typename QuadricErrorType>
class TMeshSimplification : public FMeshRefinerBase

Remarks

Implementation of Garland & Heckbert Quadric Error Metric (QEM) Triangle Mesh Simplification

Variables

Name Description

Public variable

bool

 

bAllowSeamCollapse

If true, we allow UV and Normal seams to collapse during simplification.

Protected variable

bool

 

bHaveBoundary

Public variable

bool

 

bPreserveBoundaryShape

If true, we try to keep boundary vertices on boundary. You probably want this.

Public variable

bool

 

bRetainQuadricMemory

If false, face and vertex quadrics are recomputed in the neighborhood of each collapse, definitely slower but maybe higher quality

Public variable

ESimplification...

 

CollapseMode

Controls the method used when selecting the position the results from an edge collapse.

Protected variable

int

 

COUNT_COLLAPSES

Testing/debug/profiling stuff profiling functions, turn on ENABLE_PROFILING to see output in console

Protected variable

int

 

COUNT_ITERATIONS

Protected variable

TArray< QEdge >

 

EdgeQuadrics

Protected variable

FIndexPriorityQ...

 

EdgeQueue

Public variable

EEdgeRefineFlag...

 

GroupBoundaryConstraint

Protected variable

TArray< bool >

 

IsBoundaryVtxCache

Public variable

EEdgeRefineFlag...

 

MaterialBoundaryConstraint

Protected variable

int

 

MaxEdgeID

Protected variable

float

 

MaxErrorAllowed

Public variable

EEdgeRefineFlag...

 

MeshBoundaryConstraint

When using the constraint system, these options will apply to the appropriate boundaries.

Protected variable

double

 

MinEdgeLength

Protected variable

const int

 

ModuloPrime

We are using a modulo-index loop to break symmetry/pathological conditions.

Protected variable

FDynamicMeshNor...

 

NormalOverlay

Protected variable

double

 

SeamEdgeWeight

Protected variable

TMap< int, FSea...

 

seamQuadrics

Protected variable

ETargetModes

 

SimplifyMode

Protected variable

int

 

TargetCount

Protected variable

TArray< double ...

 

triAreas

Protected variable

TArray< FQuadri...

 

triQuadrics

Protected variable

TArray< FQuadri...

 

vertQuadrics

Constructors

Functions

Name Description

Protected function Virtual

void

 

ApplyToProjectVertices

(
    const TFunction< void>& apply...
)

Protected function Const

FQuadricErro...

 

AssembleEdgeQuadric

(
    const FDynamicMesh3::FEdge& edge
)

Uses pre-computed vertex, face and seam quadrics to construct the edge quadric.

Protected function

ESimplificat...

 

CollapseEdge

(
    int edgeID,
    FVector3d vNewPos,
    FDynamicMesh3::FEdgeCollapseInfo& ...,
    int32 RequireKeepVert
)

Collapse given edge.

Protected function Const

FAttrBasedQu...

 

ComputeFaceQuadric

(
    const int tid,
    FVector3d& nface,
    FVector3d& c,
    double& Area
)

Protected function Const

FQuadricErro...

 

ComputeFaceQuadric

(
    const int tid,
    FVector3d& nface,
    FVector3d& c,
    double& Area
)

Protected function Virtual

void

 

DoSimplify()

Top-level function that does the simplification

Protected function Const

bool

 

EnableInlineProjection()

This just lets us write more concise code

Public function Virtual

void

 

FastCollapsePass

(
    double MinEdgeLength,
    int Rounds,
    bool bMeshIsClosedHint
)

Does N rounds of collapsing edges longer than fMinEdgeLength.

Protected function Virtual

void

 

FullProjectionPass()

Project vertices onto projection target.

Protected function Virtual

int

 

GetNextEdge

(
    int CurEdgeID,
    bool& bDoneOut
)

Protected function Virtual

FVector3d

 

GetProjectedCollapsePosition

(
    int vid,
    const FVector3d& vNewPos
)

Used by collapse-edge to get projected position for new vertex

Protected function

FVector3d

 

GetProjectedPoint

(
    const FVector3d& pos
)

Protected function Virtual

void

 

InitializeQueue()

Protected function Virtual

void

 

InitializeSeamQuadrics()

Protected function Virtual

void

 

InitializeTriQuadrics()

Protected function Virtual

void

 

InitializeVertexQuadrics()

Protected function Const

bool

 

IsBoundaryVertex

(
    int vid
)

Protected function

void

 

OnEdgeCollapse

(
    int edgeID,
    int va,
    int vb,
    const FDynamicMesh3::FEdgeCollapseI...
)

Protected function Virtual

void

 

OnEdgeCollapse

(
    int edgeID,
    int va,
    int vb,
    const FDynamicMesh3::FEdgeCollapseI...
)

Subclasses can override these to implement custom behavior...

Protected function Virtual

void

 

OnRemoveIsolatedTriangle

(
    int tId
)

Protected function

FVector3d

 

OptimalPoint

(
    int eid,
    const FQuadricErrorType& q,
    int ea,
    int eb
)

Return point that minimizes quadric error for edge [ea,eb]

Protected function

void

 

Precompute

(
    bool bMeshIsClosed
)

Protected function Virtual

void

 

ProfileBeginCollapse()

Protected function Virtual

void

 

ProfileBeginOps()

Protected function Virtual

void

 

ProfileBeginPass()

Protected function Virtual

void

 

ProfileBeginProject()

Protected function Virtual

void

 

ProfileBeginSetup()

Protected function Virtual

void

 

ProfileEndCollapse()

Protected function Virtual

void

 

ProfileEndOps()

Protected function Virtual

void

 

ProfileEndPass()

Protected function Virtual

void

 

ProfileEndProject()

Protected function Virtual

void

 

ProfileEndSetup()

Protected function Virtual

void

 

ProjectVertex

(
    int vID,
    IProjectionTarget* targetIn
)

Protected function

bool

 

RemoveIsolatedTriangle

(
    int tID
)

Remove an isolated triangle.

Protected function Virtual

void

 

Reproject()

Public function Virtual

void

 

SimplifyToEdgeLength

(
    double MinEdgeLength
)

Simplify mesh until no edges smaller than min length remain. This is not a great criteria.

Public function Virtual

void

 

SimplifyToMaxError

(
    double MaxError
)

Simplify mesh until the quadric error of an edge collapse exceeds the specified criteria.

Public function Virtual

void

 

SimplifyToMinimalPlanar

(
    double CoplanarAngleTolDeg,
    TFunctionRef< bool EdgeID)> E...
)

Maximally collapse mesh in a way that does not change shape at all.

Public function Virtual

void

 

SimplifyToTriangleCount

(
    int TriangleCount
)

Simplify mesh until we reach a specific triangle count.

Public function Virtual

void

 

SimplifyToVertexCount

(
    int VertexCount
)

Simplify mesh until it has a specific vertex count

Protected function Virtual

int

 

StartEdges()

Protected function Virtual

void

 

UpdateNeighborhood

(
    const FDynamicMesh3::FEdgeCollapseI...
)

Update queue weight for each edge in vertex one-ring and rebuild and quadrics necessary

Classes

Name

Description

Protected struct

FEdgeError

Protected struct

QEdge

Internal class for priority queue

Enums

Typedefs

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss