TDynamicMeshOverlay

[TDynamicMeshOverlay](API\Plugins\DynamicMesh\TDynamicMeshOverlay) is an add-on to a [FDynamicMesh3](API\Plugins\DynamicMesh\FDynamicMesh3) that allows for per-triangle storage of an "element" (eg like a per-triangle UV or normal).

Windows
MacOS
Linux

Inheritance Hierarchy

TDynamicMeshOverlay

TDynamicMeshVectorOverlay

References

Module

DynamicMesh

Header

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

Include

#include "DynamicMeshOverlay.h"

Syntax

template<typename RealType, int ElementSize>
class TDynamicMeshOverlay

Remarks

TDynamicMeshOverlay is an add-on to a FDynamicMesh3 that allows for per-triangle storage of an "element" (eg like a per-triangle UV or normal). However the elements can be shared between triangles because they are stored in a separate indexable list. As a result, the overlay has it's own topology, IE there may be "seam" boundary edges in the overlay topology that are not mesh boundary edges in the associated/parent mesh.

A "seam" edge is one where at least one of the elements of the triangles on either side of the edge is not shared between the two triangles.

The FDynamicMesh3 mesh topology operations (eg split/flip/collapse edge, poke face, etc) can be mirrored to the overlay via OnSplitEdge(), etc.

that although this is a template, many of the functions are defined in the .cpp file. As a result you need to explicitly instantiate and export the instance of the template that you wish to use in the block at the top of DynamicMeshOverlay.cpp

Variables

Name Description

Protected variable

TDynamicVector<...

 

Elements

List of element values

Protected variable

FRefCountVector

 

ElementsRefCounts

Reference counts of element indices. Iterate over this to find out which elements are valid.

Protected variable

TDynamicVector<...

 

ElementTriangles

List of triangle element-index triplets [Elem0 Elem1 Elem2]

Protected variable

FDynamicMesh3 &...

 

ParentMesh

The parent mesh this overlay belongs to

Protected variable

TDynamicVector<...

 

ParentVertices

List of parent vertex indices, one per element

Constructors

Name Description

Public function

TDynamicMeshOverlay()

Create an empty overlay

Public function

TDynamicMeshOverlay

(
    FDynamicMesh3* ParentMeshIn
)

Create an overlay for the given parent mesh

Functions

Name Description

Public function

int

 

AppendElement

(
    RealType ConstantValue
)

Allocate a new element with the given constant value

Public function

int

 

AppendElement

(
    const RealType* Value
)

Allocate a new element with the given value

Public function Const

bool

 

AreTrianglesConnected

(
    int TriangleID0,
    int TriangleID1
)

Public function

void

 

BeginUnsafeElementsInsert()

Support for inserting element at specific ID.

Public function Const

bool

 

CheckValidity

(
    bool bAllowNonManifoldVertices,
    EValidityCheckFailMode FailMode
)

Checks that the overlay mesh is well-formed, ie all internal data structures are consistent

Public function

void

 

ClearElements()

Discard current set of elements, but keep triangles

Public function

void

 

CompactCopy

(
    const FCompactMaps& CompactMaps,
    const TDynamicMeshOverlay< RealType...
)

Copy the Copy overlay to a compact rep, also updating parent references based on the CompactMaps

Public function

void

 

CompactInPlace

(
    const FCompactMaps& CompactMaps
)

Compact overlay and update links to parent based on CompactMaps

Public function

void

 

Copy

(
    const TDynamicMeshOverlay< RealType...
)

Set this overlay to contain the same arrays as the copy overlay

Public function Const

int

 

CountVertexElements

(
    int VertexID,
    bool bBruteForce
)

Count the number of unique elements for a given parent-mesh vertex

Public function

void

 

CreateFromPredicate

(
    TFunctionRef< bool(int ParentVertex...,
    RealType InitElementValue
)

Build overlay topology from a predicate function, e.g. to build topology for sharp normals

Public function Const

int

 

ElementCount()

Public function Const

element_iter...

 

ElementIndicesItr()

Public function

void

 

EndUnsafeElementsInsert()

Call after a set of unsafe InsertVertex() calls to rebuild free list

Public function Const

void

 

GetElement

(
    int ElementID,
    AsType& Data
)

Get the element at a given index

Public function Const

void

 

GetElement

(
    int ElementID,
    RealType* Data
)

Accessors/QueriesGet the element at a given index

Public function Const

void

 

GetElementTriangles

(
    int ElementID,
    TArray< int >& OutTriangles
)

Find the triangles connected to an element

Public function Const

const FDynam...

 

GetParentMesh()

Public function

FDynamicMesh...

 

GetParentMesh()

Public function Const

int

 

GetParentVertex

(
    int ElementID
)

Get the parent vertex id for the element at a given index

Public function Const

FIndex3i

 

GetTriangle

(
    int TriangleID
)

Get the element index tuple for a triangle

Public function Const

void

 

GetTriBaryInterpolate

(
    int32 TriangleID,
    const AsType* BaryCoords,
    AsType* DataOut
)

Compute interpolated parameter value inside triangle using barycentric coordinates

Public function Const

void

 

GetVertexElements

(
    int VertexID,
    TArray< int >& OutElements
)

Find the elements associated with a given parent-mesh vertex

Public function Const

bool

 

HasInteriorSeamEdges()

Public function

void

 

InitializeNewTriangle

(
    int TriangleID
)

Set a triangle's element indices to InvalidID

Public function

void

 

InitializeTriangles

(
    int MaxTriangleID
)

Initialize the triangle list to the given size, and set all triangles to InvalidID

Public function

EMeshResult

 

InsertElement

(
    int ElementID,
    const RealType* Value,
    bool bUnsafe
)

Insert element at given index, assuming it is unused.

Protected function

void

 

InternalSetTriangle

(
    int TriangleID,
    const FIndex3i& TriElements,
    bool bIncrementRefCounts
)

Updates the triangles array and optionally the element reference counts

Public function Const

bool

 

IsBowtieInOverlay

(
    int32 VertexID
)

Determines whether the base-mesh vertex has "bowtie" topology in the Overlay.

Public function Const

bool

 

IsCompact()

Public function Const

bool

 

IsElement

(
    int vID
)

Public function Const

bool

 

IsSeamEdge

(
    int EdgeID
)

Returns true if the parent-mesh edge is a "Seam" in this overlay

Public function Const

bool

 

IsSeamEndEdge

(
    int EdgeID
)

Returns true if the parent-mesh edge is a "Seam End" in this overlay, meaning the adjacent element triangles share one element, not two

Public function Const

bool

 

IsSeamVertex

(
    int VertexID,
    bool bBoundaryIsSeam
)

Returns true if the parent-mesh vertex is connected to any seam edges

Public function Const

bool

 

IsSetTriangle

(
    int TID
)

Public function Const

int

 

MaxElementID()

Public function

void

 

OnCollapseEdge

(
    const DynamicMeshInfo::FEdgeCollaps...
)

Update the overlay to reflect an edge collapse in the parent mesh

Public function

void

 

OnFlipEdge

(
    const DynamicMeshInfo::FEdgeFlipInf...
)

Update the overlay to reflect an edge flip in the parent mesh

Public function

void

 

OnMergeEdges

(
    const DynamicMeshInfo::FMergeEdgesI...
)

Update the overlay to reflect an edge merge in the parent mesh

Public function

void

 

OnPokeTriangle

(
    const DynamicMeshInfo::FPokeTriangl...
)

Update the overlay to reflect a face poke in the parent mesh

Public function

void

 

OnRemoveTriangle

(
    int TriangleID
)

Remove a triangle from the overlay

Public function

void

 

OnReverseTriOrientation

(
    int TriangleID
)

Reverse the orientation of a triangle's elements

Public function

void

 

OnSplitEdge

(
    const DynamicMeshInfo::FEdgeSplitIn...
)

Update the overlay to reflect an edge split in the parent mesh

Public function

void

 

OnSplitVertex

(
    const DynamicMeshInfo::FVertexSplit...,
    const TArrayView< const int >& Tri...
)

Update the overlay to reflect a vertex split in the parent mesh

Public function

void

 

SetElement

(
    int ElementID,
    const AsType& Data
)

Set the element at a given index

Public function

void

 

SetElement

(
    int ElementID,
    const RealType* Data
)

Set the element at a given index

Protected function

void

 

SetElementFromBary

(
    int SetElement,
    int ElementA,
    int ElementB,
    int ElementC,
    const FVector3< RealType >& BaryCo...
)

Set the value at an Element to be a barycentric interpolation of three other Elements

Protected function

void

 

SetElementFromLerp

(
    int SetElement,
    int ElementA,
    int ElementB,
    RealType Alpha
)

Set the value at an Element to be a linear interpolation of two other Elements

Public function

EMeshResult

 

SetTriangle

(
    int TriangleID,
    const FIndex3i& TriElements
)

Set the triangle to the given Element index tuple, and increment element reference counts

Public function

void

 

SplitBowties()

Refine an existing overlay topology by splitting any bow ties

Public function

int

 

SplitElement

(
    int ElementID,
    const TArrayView< const int >& Tri...
)

Create a new copy of ElementID, and update connected triangles in the TrianglesToUpdate array to reference the copy of ElementID where they used to reference ElementID (

This just calls "SplitElementWithNewParent" with the existing element's parent id.)

Public function

int

 

SplitElementWithNewParent

(
    int ElementID,
    int SplitParentVertexID,
    const TArrayView< const int >& Tri...
)

Create a new copy of ElementID, and update connected triangles in the TrianglesToUpdate array to reference the copy of ElementID where they used to reference ElementID.

Public function

void

 

SplitVerticesWithPredicate

(
    TFunctionRef< bool< void(int ElementIdx, ...
)

Refine an existing overlay topology.

Public function Const

bool

 

TriangleHasElement

(
    int TriangleID,
    int ElementID
)

Public function

void

 

UnsetTriangle

(
    int TriangleID
)

Set the triangle to have InvalidID element IDs, decrementing element reference counts if needed.

Typedefs

Name

Description

element_iterator

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