5 #include "CoreMinimal.h" 16 Value = 0.30f * Vector.X + 0.33f * Vector.Y + 0.37f * Vector.Z;
34 static TMultiMap<uint32, uint32>
FindDuplicateVerticesMap(TFunction<FVector(int32)> VertexAccessor, int32 NumVertices,
float Tollerance = 0.0)
36 TArray<FRuntimeMeshVertexSortingElement> VertexSorter;
37 VertexSorter.Empty(NumVertices);
47 TMultiMap<uint32, uint32> IndexMap;
52 uint32 SrcVertIdx = VertexSorter[
Index].Index;
56 for (int32 SubIndex =
Index + 1; SubIndex < NumVertices; SubIndex++)
58 if (FMath::Abs(VertexSorter[SubIndex].Value - Value) > THRESH_POINTS_ARE_SAME * 4.01
f)
64 uint32 OtherVertIdx = VertexSorter[SubIndex].Index;
65 if (VertexAccessor(SrcVertIdx).
Equals(VertexAccessor(OtherVertIdx), Tollerance))
67 IndexMap.AddUnique(SrcVertIdx, OtherVertIdx);
68 IndexMap.AddUnique(OtherVertIdx, SrcVertIdx);
78 int32 NumVertices = Vertices.Num();
80 TArray<FRuntimeMeshVertexSortingElement> VertexSorter;
81 VertexSorter.Empty(NumVertices);
91 TMultiMap<uint32, uint32> IndexMap;
96 uint32 SrcVertIdx = VertexSorter[
Index].Index;
100 for (int32 SubIndex =
Index + 1; SubIndex < NumVertices; SubIndex++)
102 if (FMath::Abs(VertexSorter[SubIndex].Value - Value) > THRESH_POINTS_ARE_SAME * 4.01
f)
108 uint32 OtherVertIdx = VertexSorter[SubIndex].Index;
109 if (Vertices[SrcVertIdx].
Equals(Vertices[OtherVertIdx], Tollerance))
111 IndexMap.AddUnique(SrcVertIdx, OtherVertIdx);
112 IndexMap.AddUnique(OtherVertIdx, SrcVertIdx);
122 int32 NumVertices = Vertices.Num();
124 TArray<FRuntimeMeshVertexSortingElement> VertexSorter;
125 VertexSorter.Empty(NumVertices);
135 TArray<uint32> IndexMap;
136 IndexMap.AddUninitialized(NumVertices);
137 FMemory::Memset(IndexMap.GetData(), 0xFF, NumVertices *
sizeof(uint32));
142 uint32 SrcVertIdx = VertexSorter[
Index].Index;
144 IndexMap[SrcVertIdx] = FMath::Min(IndexMap[SrcVertIdx], SrcVertIdx);
147 for (int32 SubIndex =
Index + 1; SubIndex < NumVertices; SubIndex++)
149 if (FMath::Abs(VertexSorter[SubIndex].Value - Value) > THRESH_POINTS_ARE_SAME * 4.01
f)
155 uint32 OtherVertIdx = VertexSorter[SubIndex].Index;
156 if (Vertices[SrcVertIdx].
Equals(Vertices[OtherVertIdx], Tollerance))
158 IndexMap[SrcVertIdx] = FMath::Min(IndexMap[SrcVertIdx], OtherVertIdx);
159 IndexMap[OtherVertIdx] = FMath::Min(IndexMap[OtherVertIdx], SrcVertIdx);
static TArray< uint32 > FindDuplicateVertices(const TArray< FVector > &Vertices, float Tollerance=0.0)
FRuntimeMeshVertexSortingElement()
FORCEINLINE bool operator()(FRuntimeMeshVertexSortingElement const &Left, FRuntimeMeshVertexSortingElement const &Right) const
StdString::EqualsMatcher Equals(std::string const &str, CaseSensitive::Choice caseSensitivity=CaseSensitive::Yes)
static TMultiMap< uint32, uint32 > FindDuplicateVerticesMap(TFunction< FVector(int32)> VertexAccessor, int32 NumVertices, float Tollerance=0.0)
static TMultiMap< uint32, uint32 > FindDuplicateVerticesMap(const TArray< FVector > &Vertices, float Tollerance=0.0)
FRuntimeMeshVertexSortingElement(int32 InIndex, FVector Vector)