Skip to content

Commit 0ea32e4

Browse files
committed
fix(calibration): Handle infinity during calibration
1 parent be173c6 commit 0ea32e4

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

VRCFaceTracking.Core/Params/Data/Mutation/Calibration.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,13 @@ private float Normalize(float currentValue) =>
8888

8989
public float CalculateParameter(float currentValue, float k)
9090
{
91-
if (float.IsNaN(currentValue))
91+
if (float.IsNaN(currentValue) || max == 0f)
9292
return currentValue;
9393

9494
var confidence = k * progress;
9595
var adjustedValue = confidence * Normalize(currentValue) + (1 - confidence) * currentValue;
9696

97-
if (float.IsNaN(adjustedValue))
97+
if (float.IsNaN(adjustedValue) || float.IsInfinity(adjustedValue))
9898
return currentValue;
9999

100100
return adjustedValue;

0 commit comments

Comments
 (0)