Navigation
API > API/Runtime > API/Runtime/Core > API/Runtime/Core/FMath
Description
Calculates the new value in a weighted moving average series using the previous value and a weight range. The weight range is used to dynamically adjust based upon distance between the samples This allows you to smooth a value more aggressively for small noise and let large movements be smoothed less (or vice versa)
| Name | DynamicWeightedMovingAverage |
| Type | function |
| Header File | /Engine/Source/Runtime/Core/Public/Math/UnrealMathUtility.h |
| Include Path | #include "Math/UnrealMathUtility.h" |
template<typename T>
static T DynamicWeightedMovingAverage
(
T CurrentSample,
T PreviousSample,
T MaxDistance,
T MinWeight,
T MaxWeight
)
the next value in the series
Parameters
| Name | Remarks |
|---|---|
| CurrentSample | The value to blend with the previous sample to get a new weighted value |
| PreviousSample | The last value from the series |
| MaxDistance | Distance to use as the blend between min weight or max weight |
| MinWeight | The weight use when the distance is small |
| MaxWeight | The weight use when the distance is large |