using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace TransportGame.Utils { public static class MathHelper { /// /// Clamps given value in the [0,1] interval /// /// Value /// Clamped value public static float Clamp01(float value) { return Clamp(value, 0, 1); } /// /// Clamps given value in the [min,max] interval /// /// Value /// Minimum value /// Maximum value /// Clamped value public static float Clamp(float value, float min, float max) { if (value < min) return min; if (value > max) return max; return value; } } }