Merge pull request #19231 from aaronfranke/mono-fposmod-to-mod
[Mono] Rename Fposmod to PosMod, fix output
This commit is contained in:
commit
d4f860c768
|
@ -138,16 +138,6 @@ namespace Godot
|
|||
return (real_t)Math.Floor(s);
|
||||
}
|
||||
|
||||
public static real_t Fposmod(real_t x, real_t y)
|
||||
{
|
||||
if (x >= 0f)
|
||||
{
|
||||
return x % y;
|
||||
}
|
||||
|
||||
return y - -x % y;
|
||||
}
|
||||
|
||||
public static real_t InverseLerp(real_t from, real_t to, real_t weight)
|
||||
{
|
||||
return (weight - from) / (to - from);
|
||||
|
@ -210,6 +200,32 @@ namespace Godot
|
|||
return new Vector2(r * Cos(th), r * Sin(th));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs a canonical Modulus operation, where the output is on the range [0, b).
|
||||
/// </summary>
|
||||
public static real_t PosMod(real_t a, real_t b)
|
||||
{
|
||||
real_t c = a % b;
|
||||
if ((c < 0 && b > 0) || (c > 0 && b < 0))
|
||||
{
|
||||
c += b;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs a canonical Modulus operation, where the output is on the range [0, b).
|
||||
/// </summary>
|
||||
public static int PosMod(int a, int b)
|
||||
{
|
||||
int c = a % b;
|
||||
if ((c < 0 && b > 0) || (c > 0 && b < 0))
|
||||
{
|
||||
c += b;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
public static real_t Pow(real_t x, real_t y)
|
||||
{
|
||||
return (real_t)Math.Pow(x, y);
|
||||
|
|
|
@ -1 +1 @@
|
|||
3
|
||||
4
|
||||
|
|
Loading…
Reference in New Issue