UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
WeightMapTypes.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "BoxTypes.h"
6#include "CoreMinimal.h"
7#include "VectorTypes.h"
8#include "IndexTypes.h"
9
10namespace UE
11{
12namespace Geometry
13{
14
19template<typename RealType>
21{
22public:
23 RealType DefaultValue;
25
26 int32 Num() const { return Values.Num(); }
27
29 {
31 }
32
33 RealType GetValueUnsafe(int32 Index) const
34 {
35 return Values[Index];
36 }
37
38 RealType GetValue(int32 Index) const
39 {
40 return (Index >= 0 && Index < Values.Num()) ? Values[Index] : DefaultValue;
41 }
42
43 RealType GetInterpValueUnsafe(const FIndex3i& Indices, const FVector3d& BaryCoords) const
44 {
45 return (RealType)((double)Values[Indices.A] * BaryCoords.X
46 + (double)Values[Indices.B] * BaryCoords.Y
47 + (double)Values[Indices.C] * BaryCoords.Z);
48 }
49
50 RealType GetInterpValue(const FIndex3i& Indices, const FVector3d& BaryCoords) const
51 {
52 RealType A = GetValue(Indices.A);
53 RealType B = GetValue(Indices.B);
54 RealType C = GetValue(Indices.C);
55
56 return (RealType)((double)A*BaryCoords.X + (double)B*BaryCoords.Y + (double)C*BaryCoords.Z);
57 }
58
59 void InvertWeightMap(TInterval1<RealType> Range = TInterval1<RealType>((RealType)0, (RealType)1.0))
60 {
61 int32 Num = Values.Num();
62 for (int32 k = 0; k < Num; ++k)
63 {
64 Values[k] = Range.Clamp((Range.Max - (Values[k] - Range.Min)));
65 }
66 }
67};
68
72
73
74} // end namespace UE::Geometry
75} // 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
UE_REWRITE SizeType Num() const
Definition Array.h:1144
void SetNum(SizeType NewNum, EAllowShrinking AllowShrinking=UE::Core::Private::AllowShrinkingByDefault< AllocatorType >())
Definition Array.h:2308
Definition WeightMapTypes.h:21
RealType GetValueUnsafe(int32 Index) const
Definition WeightMapTypes.h:33
RealType GetInterpValueUnsafe(const FIndex3i &Indices, const FVector3d &BaryCoords) const
Definition WeightMapTypes.h:43
RealType GetInterpValue(const FIndex3i &Indices, const FVector3d &BaryCoords) const
Definition WeightMapTypes.h:50
TArray< RealType > Values
Definition WeightMapTypes.h:24
RealType DefaultValue
Definition WeightMapTypes.h:23
void SetNum(int32 NewNum)
Definition WeightMapTypes.h:28
int32 Num() const
Definition WeightMapTypes.h:26
void InvertWeightMap(TInterval1< RealType > Range=TInterval1< RealType >((RealType) 0,(RealType) 1.0))
Definition WeightMapTypes.h:59
RealType GetValue(int32 Index) const
Definition WeightMapTypes.h:38
TIndexedWeightMap< float > FIndexedWeightMap
Definition WeightMapTypes.h:69
TIndexedWeightMap< float > FIndexedWeightMap1f
Definition WeightMapTypes.h:70
TIndexedWeightMap< double > FIndexedWeightMap1d
Definition WeightMapTypes.h:71
Definition AdvancedWidgetsModule.cpp:13
U16 Index
Definition radfft.cpp:71
Definition IndexTypes.h:158
int B
Definition IndexTypes.h:164
int A
Definition IndexTypes.h:163
int C
Definition IndexTypes.h:165
Definition BoxTypes.h:19
T Z
Definition Vector.h:68
T Y
Definition Vector.h:65
T X
Definition Vector.h:62