Skip to content

Commit

Permalink
returns wrong value for very small inputs unless we clamp
Browse files Browse the repository at this point in the history
  • Loading branch information
rms80 committed May 19, 2018
1 parent a7dfecd commit 4a59fcb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions math/MathUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -371,12 +371,12 @@ public static float SmoothRise0To1(float fX, float yshift, float xZero, float sp
}

public static float WyvillRise01(float fX) {
float d = 1 - fX * fX;
return (d >= 0) ? 1 - (d * d * d) : 0;
float d = MathUtil.Clamp(1.0f - fX*fX, 0.0f, 1.0f);
return 1 - (d * d * d);
}
public static double WyvillRise01(double fX) {
double d = 1 - fX * fX;
return (d >= 0) ? 1 - (d * d * d) : 0;
double d = MathUtil.Clamp(1.0 - fX*fX, 0.0, 1.0);
return 1 - (d * d * d);
}

public static float WyvillFalloff01(float fX) {
Expand Down

0 comments on commit 4a59fcb

Please sign in to comment.