UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
MeshConnectedComponents.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3// Port of geometry3sharp MeshConnectedComponents
4
5#pragma once
6
7#include "CoreMinimal.h"
8#include "IntBoxTypes.h"
11
12namespace UE
13{
14namespace Geometry
15{
16
23{
24public:
26
31 {
34 };
35
40
41public:
42
47
48 //
49 // Calculation functions. Call these to calculate different types of Components.
50 //
51
58
66
74
83
90
98
104
111
118
126
133
141
142 //
143 // Query functions. Only valid to call after a Calculation function has been called.
144 //
145
147 int32 Num() const
148 {
149 return Components.Num();
150 }
151
154
157
159 const FComponent& operator[](int32 Index) const { return Components[Index]; }
160
163
168
174
175
176
177public:
182 auto begin() { return Components.begin(); }
183 auto begin() const { return Components.begin(); }
184 auto end() { return Components.end(); }
185 auto end() const { return Components.end(); }
186
187
188
189protected:
190 //
191 // Internal functions to calculate ROI
192 //
198
203
204public:
216 const TArray<int>& InputROI,
218 TArray<int32>* QueueBuffer = nullptr,
219 TSet<int32>* DoneBuffer = nullptr,
220 TFunctionRef<bool(int32, int32)> CanGrowPredicate = [](int32, int32) { return true; }
221 );
222
223
234 static GEOMETRYCORE_API void GrowToConnectedTriangles(const FDynamicMesh3* Mesh,
235 const TArray<int>& InputROI,
237 TArray<int32>* QueueBuffer = nullptr,
238 TFunctionRef<bool(int32, int32)> CanGrowPredicate = [](int32, int32) { return true; }
239 );
240
241
251 const FDynamicMesh3& Mesh,
252 const TArray<int>& InputROI,
254 TArray<int32>* QueueBuffer = nullptr,
255 TFunctionRef<bool(int32, int32)> CanGrowPredicate = [](int32, int32) { return true; }
256 );
257
258
268 const FDynamicMesh3& Mesh,
269 const TArray<int>& InputROI,
271 TArray<int32>* QueueBuffer = nullptr,
272 TFunctionRef<bool(int32, int32)> CanGrowPredicate = [](int32, int32) { return true; }
273 );
274
275
276};
277
278
279} // end namespace UE::Geometry
280} // 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 AssetRegistryState.h:50
Definition AndroidPlatformMisc.h:14
Definition IndirectArray.h:20
Definition DynamicMesh3.h:108
Definition MeshConnectedComponents.h:23
GEOMETRYCORE_API void FindConnectedVertices(TFunction< bool(int32, int32)> VertsConnectedPredicate=nullptr)
Definition MeshConnectedComponents.cpp:114
auto begin() const
Definition MeshConnectedComponents.h:183
GEOMETRYCORE_API int32 GetLargestIndexByCount() const
Definition MeshConnectedComponents.cpp:476
GEOMETRYCORE_API void RemoveFromActiveSet(const FComponent *Component, TArray< uint8 > &ActiveSet)
Definition MeshConnectedComponents.cpp:339
GEOMETRYCORE_API bool InitializeFromTriangleComponents(const TArray< TArray< int32 > > &ComponentLists, bool bValidateIDs)
Definition MeshConnectedComponents.cpp:517
const FDynamicMesh3 * Mesh
Definition MeshConnectedComponents.h:25
GEOMETRYCORE_API void SortByCount(bool bLargestFirst=true)
Definition MeshConnectedComponents.cpp:497
const FComponent & GetComponent(int32 Index) const
Definition MeshConnectedComponents.h:153
GEOMETRYCORE_API void FindVertComponents(FInterval1i ActiveRange, TArray< uint8 > &ActiveSet, TFunction< bool(int32, int32)> VertsConnectedPredicate)
Definition MeshConnectedComponents.cpp:349
GEOMETRYCORE_API void FindTrianglesConnectedToSeeds(const TArray< int > &SeedTriangles, TFunction< bool(int32, int32)> TrisConnectedPredicate=nullptr)
Definition MeshConnectedComponents.cpp:94
const FComponent & operator[](int32 Index) const
Definition MeshConnectedComponents.h:159
GEOMETRYCORE_API void FindTriComponent(FComponent *Component, TArray< int32 > &ComponentQueue, TArray< uint8 > &ActiveSet)
Definition MeshConnectedComponents.cpp:287
FComponent & operator[](int32 Index)
Definition MeshConnectedComponents.h:162
static GEOMETRYCORE_API void GrowToConnectedVertices(const FDynamicMesh3 &Mesh, const TArray< int > &InputROI, TSet< int > &ResultROI, TArray< int32 > *QueueBuffer=nullptr, TFunctionRef< bool(int32, int32)> CanGrowPredicate=[](int32, int32) { return true;})
Definition MeshConnectedComponents.cpp:744
FComponent & GetComponent(int32 Index)
Definition MeshConnectedComponents.h:156
auto begin()
Definition MeshConnectedComponents.h:182
GEOMETRYCORE_API bool InitializeFromVertexComponents(const TArray< TArray< int32 > > &ComponentLists, bool bValidateIDs)
Definition MeshConnectedComponents.cpp:594
GEOMETRYCORE_API void FindTriComponents(FInterval1i ActiveRange, TArray< uint8 > &ActiveSet, TFunction< bool(int32, int32)> TriConnectedPredicate)
Definition MeshConnectedComponents.cpp:204
auto end() const
Definition MeshConnectedComponents.h:185
GEOMETRYCORE_API void FindVertComponent(FComponent *Component, TArray< int32 > &ComponentQueue, TArray< uint8 > &ActiveSet)
Definition MeshConnectedComponents.cpp:425
int32 Num() const
Definition MeshConnectedComponents.h:147
GEOMETRYCORE_API void FindVerticesConnectedToSeeds(const TArray< int > &SeedVertices, TFunction< bool(int32, int32)> VertsConnectedPredicate=nullptr)
Definition MeshConnectedComponents.cpp:184
FMeshConnectedComponents(const FDynamicMesh3 *MeshIn)
Definition MeshConnectedComponents.h:43
static GEOMETRYCORE_API void GrowToConnectedEdges(const FDynamicMesh3 &Mesh, const TArray< int > &InputROI, TSet< int > &ResultROI, TArray< int32 > *QueueBuffer=nullptr, TFunctionRef< bool(int32, int32)> CanGrowPredicate=[](int32, int32) { return true;})
Definition MeshConnectedComponents.cpp:776
auto end()
Definition MeshConnectedComponents.h:184
static GEOMETRYCORE_API void GrowToConnectedTriangles(const FDynamicMesh3 *Mesh, const TArray< int > &InputROI, TArray< int > &ResultROI, TArray< int32 > *QueueBuffer=nullptr, TSet< int32 > *DoneBuffer=nullptr, TFunctionRef< bool(int32, int32)> CanGrowPredicate=[](int32, int32) { return true;})
Definition MeshConnectedComponents.cpp:673
TIndirectArray< FComponent > Components
Definition MeshConnectedComponents.h:39
GEOMETRYCORE_API void FindConnectedTriangles(TFunction< bool(int32, int32)> TrisConnectedPredicate=nullptr)
Definition MeshConnectedComponents.cpp:24
Definition AdvancedWidgetsModule.cpp:13
U16 Index
Definition radfft.cpp:71
Definition IntBoxTypes.h:13
Definition MeshConnectedComponents.h:31
TArray< int > Indices
Definition MeshConnectedComponents.h:33