Various helper methods for working with math.
More...
|
static byte | Clamp (byte value, byte min, byte max) |
| Clamps the specified byte between a minimum and maximum value. More...
|
|
static short | Clamp (short value, short min, short max) |
| Clamps the specified short between a minimum and maximum value. More...
|
|
static ushort | Clamp (ushort value, ushort min, ushort max) |
| Clamps the specified unsigned short between a minimum and maximum value. More...
|
|
static int | Clamp (int value, int min, int max) |
| Clamps the specified integer between a minimum and maximum value. More...
|
|
static uint | Clamp (uint value, uint min, uint max) |
| Clamps the specified unsigned integer between a minimum and maximum value. More...
|
|
static long | Clamp (long value, long min, long max) |
| Clamps the specified 64-bit integer between a minimum and maximum value. More...
|
|
static ulong | Clamp (ulong value, ulong min, ulong max) |
| Clamps the specified 64-bit unsigned integer between a minimum and maximum value. More...
|
|
static float | Clamp (float value, float min, float max) |
| Clamps the specified float between a minimum and maximum value. More...
|
|
static double | Clamp (double value, double min, double max) |
| Clamps the specified double between a minimum and maximum value. More...
|
|
static decimal | Clamp (decimal value, decimal min, decimal max) |
| Clamps the specified decimal between a minimum and maximum value. More...
|
|
Various helper methods for working with math.
static byte TriDevs.TriEngine.Helpers.Math.Clamp |
( |
byte |
value, |
|
|
byte |
min, |
|
|
byte |
max |
|
) |
| |
|
static |
Clamps the specified byte between a minimum and maximum value.
- Parameters
-
value | Value to clamp. |
min | If the specified byte is below this value, then this will be returned. |
max | If the specified byte is above this value, then this will be returned. |
- Returns
- The clamped value of the byte.
43 throw new ArgumentException(
"Minimum value cannot be greater than maximum value.",
"min");
45 return value < min ? min : (value > max ? max : value);
static short TriDevs.TriEngine.Helpers.Math.Clamp |
( |
short |
value, |
|
|
short |
min, |
|
|
short |
max |
|
) |
| |
|
static |
Clamps the specified short between a minimum and maximum value.
- Parameters
-
value | Value to clamp. |
min | If the specified short is below this value, then this will be returned. |
max | If the specified short is above this value, then this will be returned. |
- Returns
- The clamped value of the short.
58 throw new ArgumentException(
"Minimum value cannot be greater than maximum value.",
"min");
60 return value < min ? min : (value > max ? max : value);
static ushort TriDevs.TriEngine.Helpers.Math.Clamp |
( |
ushort |
value, |
|
|
ushort |
min, |
|
|
ushort |
max |
|
) |
| |
|
static |
Clamps the specified unsigned short between a minimum and maximum value.
- Parameters
-
value | Value to clamp. |
min | If the specified unsigned short is below this value, then this will be returned. |
max | If the specified unsigned short is above this value, then this will be returned. |
- Returns
- The clamped value of the unsigned short.
73 throw new ArgumentException(
"Minimum value cannot be greater than maximum value.",
"min");
75 return value < min ? min : (value > max ? max : value);
static int TriDevs.TriEngine.Helpers.Math.Clamp |
( |
int |
value, |
|
|
int |
min, |
|
|
int |
max |
|
) |
| |
|
static |
Clamps the specified integer between a minimum and maximum value.
- Parameters
-
value | Value to clamp. |
min | If the specified integer is below this value, then this will be returned. |
max | If the specified integer is above this value, then this will be returned. |
- Returns
- The clamped value of the integer.
88 throw new ArgumentException(
"Minimum value cannot be greater than maximum value.",
"min");
90 return value < min ? min : (value > max ? max : value);
static uint TriDevs.TriEngine.Helpers.Math.Clamp |
( |
uint |
value, |
|
|
uint |
min, |
|
|
uint |
max |
|
) |
| |
|
static |
Clamps the specified unsigned integer between a minimum and maximum value.
- Parameters
-
value | Value to clamp. |
min | If the specified unsigned integer is below this value, then this will be returned. |
max | If the specified unsigned integer is above this value, then this will be returned. |
- Returns
- The clamped value of the unsigned integer.
103 throw new ArgumentException(
"Minimum value cannot be greater than maximum value.",
"min");
105 return value < min ? min : (value > max ? max : value);
static long TriDevs.TriEngine.Helpers.Math.Clamp |
( |
long |
value, |
|
|
long |
min, |
|
|
long |
max |
|
) |
| |
|
static |
Clamps the specified 64-bit integer between a minimum and maximum value.
- Parameters
-
value | Value to clamp. |
min | If the specified 64-bit integer is below this value, then this will be returned. |
max | If the specified 64-bit integer is above this value, then this will be returned. |
- Returns
- The clamped value of the 64-bit integer.
118 throw new ArgumentException(
"Minimum value cannot be greater than maximum value.",
"min");
120 return value < min ? min : (value > max ? max : value);
static ulong TriDevs.TriEngine.Helpers.Math.Clamp |
( |
ulong |
value, |
|
|
ulong |
min, |
|
|
ulong |
max |
|
) |
| |
|
static |
Clamps the specified 64-bit unsigned integer between a minimum and maximum value.
- Parameters
-
value | Value to clamp. |
min | If the specified 64-bit unsigned integer is below this value, then this will be returned. |
max | If the specified 64-bit unsigned integer is above this value, then this will be returned. |
- Returns
- The clamped value of the 64-bit unsigned integer.
133 throw new ArgumentException(
"Minimum value cannot be greater than maximum value.",
"min");
135 return value < min ? min : (value > max ? max : value);
static float TriDevs.TriEngine.Helpers.Math.Clamp |
( |
float |
value, |
|
|
float |
min, |
|
|
float |
max |
|
) |
| |
|
static |
Clamps the specified float between a minimum and maximum value.
- Parameters
-
value | Value to clamp. |
min | If the specified float is below this value, then this will be returned. |
max | If the specified float is above this value, then this will be returned. |
- Returns
- The clamped value of the float.
148 throw new ArgumentException(
"Minimum value cannot be greater than maximum value.",
"min");
150 return value < min ? min : (value > max ? max : value);
static double TriDevs.TriEngine.Helpers.Math.Clamp |
( |
double |
value, |
|
|
double |
min, |
|
|
double |
max |
|
) |
| |
|
static |
Clamps the specified double between a minimum and maximum value.
- Parameters
-
value | Value to clamp. |
min | If the specified double is below this value, then this will be returned. |
max | If the specified double is above this value, then this will be returned. |
- Returns
- The clamped value of the double.
163 throw new ArgumentException(
"Minimum value cannot be greater than maximum value.",
"min");
165 return value < min ? min : (value > max ? max : value);
static decimal TriDevs.TriEngine.Helpers.Math.Clamp |
( |
decimal |
value, |
|
|
decimal |
min, |
|
|
decimal |
max |
|
) |
| |
|
static |
Clamps the specified decimal between a minimum and maximum value.
- Parameters
-
value | Value to clamp. |
min | If the specified decimal is below this value, then this will be returned. |
max | If the specified decimal is above this value, then this will be returned. |
- Returns
- The clamped value of the decimal.
178 throw new ArgumentException(
"Minimum value cannot be grater than maximum value.",
"min");
180 return value < min ? min : (value > max ? max : value);
The documentation for this class was generated from the following file: