UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
MeshRegionBoundaryLoops.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3// Port of geometry3cpp MeshRegionBoundaryLoops
4
5#pragma once
6
9#include "EdgeLoop.h"
11
12namespace UE
13{
14namespace Geometry
15{
16
22{
23public:
24
25 // INPUTS
26
28 const FDynamicMesh3* Mesh = nullptr;
31
32 // OUTPUTS
33
35 bool bFailed = false;
36
37public:
39
41
43
49
50
53 {
54 return Num();
55 }
56
58 int32 Num() const
59 {
60 return Loops.Num();
61 }
62
64 const FEdgeLoop& operator[](int Index) const
65 {
66 return Loops[Index];
67 }
68
70 {
71 return Loops;
72 }
73
76
77 template<typename ElementType>
79 template<typename ElementType>
81
93 template<typename StorageType, int ElementSize, typename ElementType>
97
104 template<typename StorageType, int ElementSize, typename ElementType>
107
117
118protected:
119
120 // sets of included triangles and edges
124
125 bool IsEdgeOnBoundary(int eid) const { return Edges.Contains(eid); }
126
127 // returns true for both internal and mesh boundary edges
128 // tid_in and tid_out are triangles 'in' and 'out' of set, respectively
129 GEOMETRYCORE_API bool IsEdgeOnBoundary(int eid, int& tid_in, int& tid_out) const;
130
131 // return same indices as GetEdgeV, but oriented based on attached triangle
133
134 // returns first two boundary edges, and count of total boundary edges
135 GEOMETRYCORE_API int GetVertexBoundaryEdges(int vID, int& e0, int& e1);
136
137 // e needs to be large enough (ie call GetVtxBoundaryEdges, or as large as max one-ring)
138 // returns count, ie number of elements of e that were filled
140
141
142 // [TODO] cache this : a dictionary? we will not need very many, but we will
143 // need each multiple times!
145
146 // ok, bdry_edges[0...bdry_edges_count] contains the boundary edges coming out of bowtie_v.
147 // We want to pick the best one to continue the loop that came : to bowtie_v on incoming_e.
148 // If the loops are all sane, then we will get the smallest loops by "turning left" at bowtie_v.
150
151
152 // This is called when loopV contains one or more "bowtie" vertices.
153 // These vertices *might* be duplicated : loopV (but not necessarily)
154 // If they are, we have to break loopV into subloops that don't contain duplicates.
156
157
158};
159
160
161} // end namespace UE::Geometry
162} // end namespace UE
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
Definition Array.h:670
Definition UnrealString.h.inl:34
Definition DynamicMesh3.h:108
Definition EdgeLoop.h:19
Definition SparseIndexCollectionTypes.h:21
bool Contains(int Index) const
Definition SparseIndexCollectionTypes.h:73
Definition MeshRegionBoundaryLoops.h:22
GEOMETRYCORE_API void UpdateLoopOverlayMapValidity(VidOverlayMap< ElementType > &LoopVidsToOverlayElements, const TDynamicMeshOverlay< StorageType, ElementSize > &Overlay)
GEOMETRYCORE_API bool TryExtractSubloops(TArray< int > &loopV, const TArray< int > &loopE, const TArray< int > &bowties, TArray< FEdgeLoop > &SubLoopsOut)
Definition MeshRegionBoundaryLoops.cpp:426
static GEOMETRYCORE_API bool GetTriangleSetBoundaryLoop(const FDynamicMesh3 &Mesh, const TArray< int32 > &Tris, FEdgeLoop &Loop)
Definition MeshRegionBoundaryLoops.cpp:539
const TArray< FEdgeLoop > & GetLoops() const
Definition MeshRegionBoundaryLoops.h:69
GEOMETRYCORE_API FIndex2i GetOrientedEdgeVerts(int eID, int tid_in)
Definition MeshRegionBoundaryLoops.cpp:298
FIndexFlagSet Edges
Definition MeshRegionBoundaryLoops.h:122
GEOMETRYCORE_API void SetMesh(const FDynamicMesh3 *MeshIn, const TArray< int > &RegionTris)
Definition MeshRegionBoundaryLoops.cpp:26
const FDynamicMesh3 * Mesh
Definition MeshRegionBoundaryLoops.h:28
GEOMETRYCORE_API FVector3d GetVertexNormal(int vid)
Definition MeshRegionBoundaryLoops.cpp:344
FMeshRegionBoundaryLoops()
Definition MeshRegionBoundaryLoops.h:38
TArray< int > edges_roi
Definition MeshRegionBoundaryLoops.h:123
int32 GetLoopCount() const
Definition MeshRegionBoundaryLoops.h:52
bool bFailed
Definition MeshRegionBoundaryLoops.h:35
FIndexFlagSet Triangles
Definition MeshRegionBoundaryLoops.h:121
TArray< FEdgeLoop > Loops
Definition MeshRegionBoundaryLoops.h:30
GEOMETRYCORE_API int GetVertexBoundaryEdges(int vID, int &e0, int &e1)
Definition MeshRegionBoundaryLoops.cpp:308
GEOMETRYCORE_API int GetMaxVerticesLoopIndex() const
Definition MeshRegionBoundaryLoops.cpp:63
GEOMETRYCORE_API bool Compute()
Definition MeshRegionBoundaryLoops.cpp:78
GEOMETRYCORE_API bool GetLoopOverlayMap(const FEdgeLoop &LoopIn, const TDynamicMeshOverlay< StorageType, ElementSize > &Overlay, VidOverlayMap< ElementType > &LoopVidsToOverlayElementsOut)
bool IsEdgeOnBoundary(int eid) const
Definition MeshRegionBoundaryLoops.h:125
GEOMETRYCORE_API int GetAllVertexBoundaryEdges(int vID, TArray< int > &e)
Definition MeshRegionBoundaryLoops.cpp:330
const FEdgeLoop & operator[](int Index) const
Definition MeshRegionBoundaryLoops.h:64
GEOMETRYCORE_API int FindLeftTurnEdge(int incoming_e, int bowtie_v, TArray< int > &bdry_edges, int bdry_edges_count, const FIndexFlagSet &used_edges)
Definition MeshRegionBoundaryLoops.cpp:366
int32 Num() const
Definition MeshRegionBoundaryLoops.h:58
Definition DynamicMeshOverlay.h:68
Definition AdvancedWidgetsModule.cpp:13
U16 Index
Definition radfft.cpp:71
Definition Tuple.h:652
Definition IndexTypes.h:27