|
static unsafe float | Reverse (this float value) |
|
static float | Clamp (this float value, float min, float max) |
|
static float | RemapToRange (this float value, float min, float max) |
| Remaps values outside of a range into the first multiple of that range. When it comes to signed numbers, negative is highest. For example, -128 (0xFF) vs 127 (0x7F). Because of this, the max value is non-inclusive while the min value is. More...
|
|
◆ Clamp()
static float BrawlLib.Internal.SingleExtension.Clamp |
( |
this float |
value, |
|
|
float |
min, |
|
|
float |
max |
|
) |
| |
|
inlinestatic |
19 {
20 return value <= min ? min : value >= max ? max : value;
21 }
◆ RemapToRange()
static float BrawlLib.Internal.SingleExtension.RemapToRange |
( |
this float |
value, |
|
|
float |
min, |
|
|
float |
max |
|
) |
| |
|
inlinestatic |
Remaps values outside of a range into the first multiple of that range. When it comes to signed numbers, negative is highest. For example, -128 (0xFF) vs 127 (0x7F). Because of this, the max value is non-inclusive while the min value is.
30 {
31
32 if (value < max && value >= min)
33 {
34 return value;
35 }
36
37
38 float range = max - min;
39
40
41
42
43
44 value -= range * (int) (value / range);
45
46
47
48 value += value > max ? -range : value < min ? range : 0;
49
50
51 if (value == max)
52 {
53 value = min;
54 }
55
56 return value;
57 }
◆ Reverse()
static unsafe float BrawlLib.Internal.SingleExtension.Reverse |
( |
this float |
value | ) |
|
|
inlinestatic |
6 {
7 *(uint*) &value = ((uint*) &value)->
Reverse();
8 return value;
9 }
static unsafe float Reverse(this float value)
Definition: SingleExtension.cs:5
The documentation for this class was generated from the following file:
- BrawlLib/Internal/SingleExtension.cs