AsImpL 1.0
Asynchronous Importer and run-time Loader for Unity
AsImpL.MathUtil.MathUtility Class Reference

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...
 

Detailed Description

Collection of useful mathematical methods.

Member Function Documentation

◆ ClampListIndex()

static int AsImpL.MathUtil.MathUtility.ClampListIndex ( int  index,
int  listSize 
)
static

Clamp list indices.

Parameters
indexIndex to be clamped.
listSizeSize of the list.
Returns

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/

◆ ComputeNormal()

static Vector3 AsImpL.MathUtil.MathUtility.ComputeNormal ( Vector3  vert,
Vector3  vNext,
Vector3  vPrev 
)
static

Compute the normal of a vertex of a triangle defined by its 3 vertices.

Parameters
vertVertex of the triangle where the normal is coputed.
vNextNext vertex (counter-clockwise)
vPrevPrevious vertex (counter-clockwise)
Returns
The computed normal.

◆ IsPointInTriangle()

static bool AsImpL.MathUtil.MathUtility.IsPointInTriangle ( Vector2  p1,
Vector2  p2,
Vector2  p3,
Vector2  p 
)
static

Check if a point is inside a triangle.

Parameters
p1First corner in the triangle.
p2Second corner in the triangle.
p3Third corner in the triangle.
pTest point
Returns
The result is true if the test point is inside the triangle.

From https://www.habrador.com/tutorials/math/9-useful-algorithms/ http://totologic.blogspot.se/2014/01/accurate-point-in-triangle-test.html

◆ IsTriangleOrientedClockwise()

static bool AsImpL.MathUtil.MathUtility.IsTriangleOrientedClockwise ( Vector2  v1,
Vector2  v2,
Vector2  v3 
)
static

Check if a triangle oriented clockwise or counter-clockwise.

Parameters
v1First vectex in 2D
v2Second vectex in 2D
v3Third vectex in 2D
Returns
True if the triangle is oriented clockwise.

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


The documentation for this class was generated from the following file: