Extension methods for numeric operation. More...
Static Public Member Functions | |
static float | ToRound (this float value) |
Convert the float to the rounded value. More... | |
static Vector2 | ToRound (this Vector2 value) |
Convert the UnityEngine.Vector2 to the rounded value. More... | |
static Vector3 | ToRound (this Vector3 value) |
Convert the UnityEngine.Vector3 to the rounded value. More... | |
static int | ToAbs (this int value) |
Convert the int to the absolute value. More... | |
static float | ToAbs (this float value) |
Convert the float to the absolute value. More... | |
static Vector2 | ToAbs (this Vector2 value) |
Convert the UnityEngine.Vector2 to the absolute value. More... | |
static Vector3 | ToAbs (this Vector3 value) |
Convert the UnityEngine.Vector3 to the absolute value. More... | |
static bool | ApproxFloat (this float value, float to, float range=1e-7f) |
Test if a float is close to another. More... | |
static bool | ApproxVector2 (this Vector2 value, Vector2 to, float range=1e-7f) |
Test if a UnityEngine.Vector2 is close to another. More... | |
static bool | ApproxVector3 (this Vector3 value, Vector3 to, float range=1e-7f) |
Test if a UnityEngine.Vector3 is close to another. More... | |
static bool | ApproxQuaternion (this Quaternion value, Quaternion to, bool euler=true, float range=1e-7f) |
Test if a UnityEngine.Quaternion is close to another. More... | |
static bool | ApproxColor (this Color value, Color to, float range=0.004f) |
Test if a UnityEngine.Color is close to another. More... | |
static bool | ApproxColor32 (this Color32 value, Color32 to, int range=1) |
Test if a UnityEngine.Color32 is close to another. More... | |
static Vector3 | NormalizedToPoint (this Bounds bounds, Vector3 value, bool clamp=true) |
Returns a point inside UnityEngine.Bounds , given normalized coordinates. More... | |
static Vector3 | PointToNormalized (this Bounds bounds, Vector3 value, bool clamp=true) |
Returns the normalized coordinates cooresponding of the point. More... | |
static Bounds | GetIntersect (this Bounds bounds, Bounds value, bool absolute=true) |
Get the intersected UnityEngine.Bounds with another one. More... | |
static Vector3 | GetRandomPoint (this Bounds bounds) |
Get a random point inside the UnityEngine.Bounds . More... | |
static Rect | GetOverlap (this Rect rect, Rect value, bool absolute=true) |
Get the overlaped UnityEngine.Rect with another one. More... | |
static Vector2 | GetRandomPoint (this Rect rect) |
Get a random point inside the UnityEngine.Rect . More... | |
Extension methods for numeric operation.
|
static |
Convert the float
to the rounded value.
value | Value. |
|
static |
Convert the UnityEngine.Vector2
to the rounded value.
value | Value. |
|
static |
Convert the UnityEngine.Vector3
to the rounded value.
value | Value. |
|
static |
Convert the int
to the absolute value.
value | Value. |
|
static |
Convert the float
to the absolute value.
value | Value. |
|
static |
Convert the UnityEngine.Vector2
to the absolute value.
value | Value. |
|
static |
Convert the UnityEngine.Vector3
to the absolute value.
value | Value. |
|
static |
Test if a float
is close to another.
value | Value. |
to | Value to compare. |
range | Max difference. |
|
static |
Test if a UnityEngine.Vector2
is close to another.
value | Value. |
to | Value to compare. |
range | Max difference. |
|
static |
Test if a UnityEngine.Vector3
is close to another.
value | Value. |
to | Value to compare. |
range | Max difference. |
|
static |
Test if a UnityEngine.Quaternion
is close to another.
Optional to compare eulerAngles
or each component.
value | Value. |
to | Value to compare. |
euler | To compare eulerAngles, or each component. |
range | Max difference. |
|
static |
Test if a UnityEngine.Color
is close to another.
Check by the sum of each component's absolute difference.
value | Value. |
to | Value to compare. |
range | Max difference. |
|
static |
Test if a UnityEngine.Color32
is close to another.
Check by the sum of each component's absolute difference.
value | Value. |
to | Value to compare. |
range | Max difference. |
|
static |
Returns a point inside UnityEngine.Bounds
, given normalized coordinates.
bounds | Bounds. |
value | Normalized point. |
clamp | If set to true clamp. |
|
static |
Returns the normalized coordinates cooresponding of the point.
bounds | Bounds. |
value | Point. |
clamp | If set to true clamp. |
|
static |
Get the intersected UnityEngine.Bounds
with another one.
Optional to use absolute extents to calculate. Absolute extents make result with positive extents and valid only if really intersect. Otherwise, you might get a result encapsulate the bounds or with negative extents.
bounds | Bounds. |
value | Another UnityEngine.Bounds . |
absolute | If set to true absolute. |
UnityEngine.Bounds
.
|
static |
Get a random point inside the UnityEngine.Bounds
.
bounds | Bounds. |
|
static |
Get the overlaped UnityEngine.Rect
with another one.
Optional to use absolute size to calculate. Absolute size makes the result with positive size and valid only if really overlap. Otherwise, you might get a result encapsulate the rects or with negative size.
rect | Rect. |
value | Another UnityEngine.Rect . |
absolute | If set to true absolute. |
UnityEngine.Rect
.
|
static |
Get a random point inside the UnityEngine.Rect
.
rect | Rect. |