Checks if a value is in a range (inclusive)
//http://isotopescreencapture.codeplex.com/
//The MIT License (MIT)
namespace Isotope.Math
{
public static class MathUtil
{
/// <summary>
/// Checks if a value is in a range (inclusive)
/// </summary>
/// <param name="val"></param>
/// <param name="min"></param>
/// <param name="max"></param>
/// <returns></returns>
public static bool IsInRange(double val, double min, double max)
{
return ((min <= val) && (val <= max));
}
/// <summary>
/// Checks if a value is in the range 0.0 to 1.0 inclusive
/// </summary>
/// <param name="val"></param>
/// <returns></returns>
public static bool IsInRange_0_1(double val)
{
return IsInRange(val, 0.0, 1.0);
}
}
}
Related examples in the same category