mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-19 18:53:47 +00:00
Added GTWeen
This commit is contained in:
parent
457998788e
commit
2036e4e748
152 changed files with 5889 additions and 7 deletions
27
GTweensGodot/GTweens/Source/Extensions/MathExtensions.cs
Normal file
27
GTweensGodot/GTweens/Source/Extensions/MathExtensions.cs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
using System;
|
||||
|
||||
namespace GTweens.Extensions;
|
||||
|
||||
public static class MathExtensions
|
||||
{
|
||||
public const float Deg2Rad = 0.01745329f;
|
||||
public const float Rad2Deg = 57.29578f;
|
||||
|
||||
public static float SafeDivide(float v1, float v2)
|
||||
{
|
||||
if (v2 == 0f)
|
||||
{
|
||||
return 0f;
|
||||
}
|
||||
|
||||
return v1 / v2;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loops the value t, so that it is never larger than length and never smaller than 0.
|
||||
/// </summary>
|
||||
public static float Repeat(float t, float length)
|
||||
{
|
||||
return Math.Clamp(t - (float)Math.Floor(t / length) * length, 0.0f, length);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue