// -----------------------------------------------------------------------
//
// Copyright 2015 MIT Licence. See licence.md for more information.
//
// -----------------------------------------------------------------------
namespace Perspex.Utilities
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
///
/// Provides math utilities not provided in System.Math.
///
public static class MathUtilities
{
///
/// Clamps a value between a minimum and maximum value.
///
/// The value.
/// The minimum value.
/// The maximum value.
/// The clamped value.
public static double Clamp(double val, double min, double max)
{
if (val < min)
{
return min;
}
else if (val > max)
{
return max;
}
else
{
return val;
}
}
}
}