|
AsImpL 1.0
Asynchronous Importer and run-time Loader for Unity
|
Collection of useful mathematical methods. More...
Static Public Member Functions | |
| static int | ClampListIndex (int index, int listSize) |
| Clamp list indices. More... | |
| static bool | IsPointInTriangle (Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p) |
| Check if a point is inside a triangle. More... | |
| static bool | IsTriangleOrientedClockwise (Vector2 v1, Vector2 v2, Vector2 v3) |
| Check if a triangle oriented clockwise or counter-clockwise. More... | |
| static Vector3 | ComputeNormal (Vector3 vert, Vector3 vNext, Vector3 vPrev) |
| Compute the normal of a vertex of a triangle defined by its 3 vertices. More... | |
Collection of useful mathematical methods.
|
static |
Clamp list indices.
| index | Index to be clamped. |
| listSize | Size of the list. |
Will even work if index is larger/smaller than listSize, so can loop multiple times From https://www.habrador.com/tutorials/math/9-useful-algorithms/
|
static |
Compute the normal of a vertex of a triangle defined by its 3 vertices.
| vert | Vertex of the triangle where the normal is coputed. |
| vNext | Next vertex (counter-clockwise) |
| vPrev | Previous vertex (counter-clockwise) |
|
static |
Check if a point is inside a triangle.
| p1 | First corner in the triangle. |
| p2 | Second corner in the triangle. |
| p3 | Third corner in the triangle. |
| p | Test point |
From https://www.habrador.com/tutorials/math/9-useful-algorithms/ http://totologic.blogspot.se/2014/01/accurate-point-in-triangle-test.html
|
static |
Check if a triangle oriented clockwise or counter-clockwise.
| v1 | First vectex in 2D |
| v2 | Second vectex in 2D |
| v3 | Third vectex in 2D |
This comes from: https://www.habrador.com/tutorials/math/9-useful-algorithms/ https://math.stackexchange.com/questions/1324179/how-to-tell-if-3-connected-points-are-connected-clockwise-or-counter-clockwise https://en.wikipedia.org/wiki/Curve_orientation