Include some of common math, about counting, geometry, lerp. More...
Static Public Member Functions | |
static int | Sum (params int[] values) |
Count the sum of int values. More... | |
static float | Sum (params float[] values) |
Count the sum of float values. More... | |
static Vector2 | Sum (params Vector2[] values) |
Count the sum of UnityEngine.Vector2 values. More... | |
static Vector3 | Sum (params Vector3[] values) |
Count the sum of UnityEngine.Vector3 values. More... | |
static Quaternion | Sum (params Quaternion[] values) |
Count the sum of UnityEngine.Quaternion values. More... | |
static float | SumDistance (params Vector2[] values) |
Count the sum of distances between series of UnityEngine.Vector2 . More... | |
static float | SumDistance (params Vector3[] values) |
Count the sum of distances between series of UnityEngine.Vector3 . More... | |
static float | Average (params float[] values) |
Count the average of float values. More... | |
static Vector2 | Average (params Vector2[] values) |
Count the average of UnityEngine.Vector2 values. More... | |
static Vector3 | Average (params Vector3[] values) |
Count the average of UnityEngine.Vector3 values. More... | |
static Quaternion | Average (params Quaternion[] values) |
Count the average of UnityEngine.Quaternion values. More... | |
static Color | Average (params Color[] values) |
Count the average of UnityEngine.Color values. More... | |
static Matrix4x4 | Average (params Matrix4x4[] values) |
Count the average of UnityEngine.Matrix4x4 values. More... | |
static Vector2 | Max (params Vector2[] values) |
Returns a vector that is made from the largest components of all vectors. More... | |
static Vector2 | Min (params Vector2[] values) |
Returns a vector that is made from the smallest components of all vectors. More... | |
static Vector3 | Max (params Vector3[] values) |
Returns a vector that is made from the largest components of all vectors. More... | |
static Vector3 | Min (params Vector3[] values) |
Returns a vector that is made from the smallest components of all vectors. More... | |
static float | Lerp (float from, float to, float t, bool clamp=true) |
Interpolates between from and to by t . More... | |
static float | InverseLerp (float from, float to, float value, bool clamp=true) |
Calculates the Lerp parameter between of two values. More... | |
static Vector3 | Lerp (Vector3 from, Vector3 to, float t, bool clamp=true) |
Interpolates between from and to by t . More... | |
static Vector3 | Slerp (Vector3 from, Vector3 to, float t, bool clamp=true) |
Spherically interpolates between from and to by t . More... | |
static Quaternion | Lerp (Quaternion from, Quaternion to, float t, bool clamp=true) |
Interpolates between from and to by t . More... | |
static Quaternion | Slerp (Quaternion from, Quaternion to, float t, bool clamp=true) |
Spherically interpolates between from and to by t . More... | |
static Matrix4x4 | Lerp (Matrix4x4 from, Matrix4x4 to, float t, bool clamp=true) |
Interpolates between from and to by t . More... | |
static Matrix4x4 | Slerp (Matrix4x4 from, Matrix4x4 to, float t, bool clamp=true) |
Interpolates between from and to by t . More... | |
static Quaternion | SignQuaternion (Quaternion rotation) |
Get new rotation with the corrected sign by converting to and from euler angles. More... | |
static float | ProjectFactor (Vector3 point, Vector3 from, Vector3 to, bool clamp=false) |
Projects a point onto a line segment. More... | |
static Vector3 | ProjectPoint (Vector3 point, Vector3 from, Vector3 to, bool clamp=false) |
Projects a point onto a line segment. More... | |
static bool | PointsInLine (Vector3 p1, Vector3 p2, Vector3 p3, float approx=0f) |
Check if 3 points lying on the same line. More... | |
static bool | VectorsInLine (Vector3 v1, Vector3 v2, float approx=0f) |
Check if 2 vectors lying on the same line. More... | |
static bool | PointsInPlane (Vector3 p0, Vector3 p1, Vector3 p2, Vector3 p3, float approx=0f) |
Check if 4 points lying in the same plane. More... | |
static bool | VectorsInPlane (Vector3 v1, Vector3 v2, Vector3 v3, float approx=0f) |
Check if 3 vectors lying in the same plane. More... | |
static bool | PointsToCircle (Vector3 p1, Vector3 p2, Vector3 p3, out Vector3 origin, out float radius, out Vector3 normal) |
Calculate 3 Points to a circle, normal vector by lhs order. More... | |
Include some of common math, about counting, geometry, lerp.
|
static |
Count the sum of int
values.
values | Values. |
|
static |
Count the sum of float
values.
values | Values. |
|
static |
Count the sum of UnityEngine.Vector2
values.
values | Values. |
|
static |
Count the sum of UnityEngine.Vector3
values.
values | Values. |
|
static |
Count the sum of UnityEngine.Quaternion
values.
values | Values. |
|
static |
Count the sum of distances between series of UnityEngine.Vector2
.
values | Values. |
|
static |
Count the sum of distances between series of UnityEngine.Vector3
.
values | Values. |
|
static |
Count the average of float
values.
values | Values. |
|
static |
Count the average of UnityEngine.Vector2
values.
values | Values. |
|
static |
Count the average of UnityEngine.Vector3
values.
values | Values. |
|
static |
Count the average of UnityEngine.Quaternion
values.
Use average of forward and upward to make smooth.
values | Values. |
|
static |
Count the average of UnityEngine.Color
values.
values | Values. |
|
static |
Count the average of UnityEngine.Matrix4x4
values.
values | Values. |
|
static |
Returns a vector that is made from the largest components of all vectors.
values | Values. |
|
static |
Returns a vector that is made from the smallest components of all vectors.
values | Values. |
|
static |
Returns a vector that is made from the largest components of all vectors.
values | Values. |
|
static |
Returns a vector that is made from the smallest components of all vectors.
values | Values. |
|
static |
Interpolates between from
and to
by t
.
from | Value from. |
to | Value to. |
t | Time. |
clamp | If set to true clamp. |
|
static |
Calculates the Lerp parameter between of two values.
Return zero if value from
is the same as to
.
from | Value from. |
to | Value to. |
value | Value. |
clamp | If set to true clamp. |
|
static |
Interpolates between from
and to
by t
.
from | Value from. |
to | Value to. |
t | Time. |
clamp | If set to true clamp. |
|
static |
Spherically interpolates between from
and to
by t
.
from | Value from. |
to | Value to. |
t | Time. |
clamp | If set to true clamp. |
|
static |
Interpolates between from
and to
by t
.
from | Value from. |
to | Value to. |
t | Time. |
clamp | If set to true clamp. |
|
static |
Spherically interpolates between from
and to
by t
.
from | Value from. |
to | Value to. |
t | Time. |
clamp | If set to true clamp. |
|
static |
Interpolates between from
and to
by t
.
from | Value from. |
to | Value to. |
t | Time. |
clamp | If set to true clamp. |
|
static |
Interpolates between from
and to
by t
.
Spherically interpolates axes of matrix., but position and last row linearly.
from | Value from. |
to | Value to. |
t | Time. |
clamp | If set to true clamp. |
|
static |
Get new rotation with the corrected sign by converting to and from euler angles.
Rotations present the same from different source might have contrast sign. Use this to get the same signed rotation with the same present.
w
from Transform.rotation
.w
from Quaternion.LookRotation()
.w
from Random.rotation
. rotation | Rotation. |
|
static |
Projects a point onto a line segment.
Return 0 if the point on the begin of the segment, return 1 if on the end.
point | Point. |
from | Segment from. |
to | Segment to. |
clamp | If set to true clamp between 0 and 1. |
|
static |
Projects a point onto a line segment.
point | Point. |
from | Segment from. |
to | Segment to. |
clamp | If set to true clamp the point locate on the segment. |
|
static |
Check if 3 points lying on the same line.
p1 | Point 1. |
p2 | Point 2. |
p3 | Point 3. |
approx | Approx range. |
true
, if points lying on the same line.
|
static |
Check if 2 vectors lying on the same line.
v1 | Vector 1. |
v2 | Vector 2. |
approx | Approx range. |
true
, if vectors lying on the same line.
|
static |
Check if 4 points lying in the same plane.
p0 | Point 0. |
p1 | Point 1. |
p2 | Point 2. |
p3 | Point 3. |
approx | Approx range. |
true
, if points lying in the same plane.
|
static |
Check if 3 vectors lying in the same plane.
v1 | Vector 1. |
v2 | Vector 2. |
v3 | Vector 3. |
approx | Approx range. |
true
, if vectors lying in the same plane.
|
static |
Calculate 3 Points to a circle, normal
vector by lhs order.
p1 | Point 1. |
p2 | Point 2. |
p3 | Point 3. |
origin | Origin point. |
radius | Radius. |
normal | Normal vector. |
false
, if points on the same line, not able to make a circle.