UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
SegmentMesh.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2#pragma once
3
4#include "Chaos/Core.h"
5#include "Chaos/Array.h"
6#include "Chaos/Map.h"
7#include "Chaos/Vector.h"
8
9namespace Chaos
10{
11 template<class T, int d>
12 class TParticles;
13
18 {
19 public:
21 {}
25 : MElements(MoveTemp(Other.MElements))
26 , MPointToEdgeMap(MoveTemp(Other.MPointToEdgeMap))
27 , MPointToNeighborsMap(MoveTemp(Other.MPointToNeighborsMap))
28 {}
30
31 CHAOS_API void Init(const TArray<TVec2<int32>>& Elements);
32 CHAOS_API void Init(TArray<TVec2<int32>>&& Elements);
33
35 {
36 return MElements.Num();
37 }
38
40 {
41 return MElements;
42 }
43
47 const TSet<int32>* GetNeighbors(const int32 index) const
48 {
49 return GetPointToNeighborsMap().Find(index);
50 }
51
56
61
69 const bool lengthSquared = false) const;
70
71 private:
72 CHAOS_API void _ClearAuxStructures();
73
74 CHAOS_API void _UpdatePointToNeighborsMap() const;
75
76 CHAOS_API void _UpdatePointToEdgesMap() const;
77
78 private:
79 // We use TVector rather than FEdge to represent connectivity because
80 // sizeof(TVec2<int32>) < sizeof(FEdge). FEdge has an extra int32
81 // member called Count, which we don't currently have a use for.
82 TArray<TVec2<int32>> MElements;
83
84 // Members are mutable so they can be generated on demand by const API.
85 mutable TMap<int32, TArray<int32>> MPointToEdgeMap;
86 mutable TMap<int32, TSet<int32>> MPointToNeighborsMap;
87 };
88
89 template <typename T>
91
92} // namespace Chaos
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
void Init()
Definition LockFreeList.h:4
UE_INTRINSIC_CAST UE_REWRITE constexpr std::remove_reference_t< T > && MoveTemp(T &&Obj) noexcept
Definition UnrealTemplate.h:520
Definition SegmentMesh.h:18
const TArray< TVec2< int32 > > & GetElements() const
Definition SegmentMesh.h:39
CHAOS_API const TMap< int32, TSet< int32 > > & GetPointToNeighborsMap() const
Definition SegmentMesh.cpp:49
FSegmentMesh()
Definition SegmentMesh.h:20
FSegmentMesh(FSegmentMesh &&Other)
Definition SegmentMesh.h:24
CHAOS_API const TMap< int32, TArray< int32 > > & GetPointToEdges() const
Definition SegmentMesh.cpp:72
int32 GetNumElements() const
Definition SegmentMesh.h:34
FSegmentMesh(const FSegmentMesh &Other)=delete
CHAOS_API ~FSegmentMesh()
Definition SegmentMesh.cpp:18
CHAOS_API TArray< FReal > GetEdgeLengths(const TParticles< FReal, 3 > &InParticles, const bool lengthSquared=false) const
Definition SegmentMesh.cpp:91
const TSet< int32 > * GetNeighbors(const int32 index) const
Definition SegmentMesh.h:47
Definition Particles.h:32
Definition Vector.h:41
Definition Array.h:670
Definition UnrealString.h.inl:34
Definition SkeletalMeshComponent.h:307