Added bound().
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2405 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: MathUtil.java,v 1.7 2002/10/26 23:21:19 mdb Exp $
|
// $Id: MathUtil.java,v 1.8 2003/04/12 02:06:35 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.media.util;
|
package com.threerings.media.util;
|
||||||
|
|
||||||
@@ -13,6 +13,17 @@ import java.awt.Point;
|
|||||||
*/
|
*/
|
||||||
public class MathUtil
|
public class MathUtil
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Bounds the supplied value within the specified range.
|
||||||
|
*
|
||||||
|
* @return low if value < low, high if value > high and value
|
||||||
|
* otherwise.
|
||||||
|
*/
|
||||||
|
public static int bound (int low, int value, int high)
|
||||||
|
{
|
||||||
|
return Math.min(high, Math.max(low, value));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the distance between the given points.
|
* Return the distance between the given points.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user