public static bool testPointTriangle(Vector2 point, Vector2 a, Vector2 b, Vector2 c)
{
// if point to the right of AB then outside triangle
if (Vector2Ext.cross(point - a, b - a) < 0f)
{
return(false);
}
// if point to the right of BC then outside of triangle
if (Vector2Ext.cross(point - b, c - b) < 0f)
{
return(false);
}
// if point to the right of ca then outside of triangle
if (Vector2Ext.cross(point - c, a - c) < 0f)
{
return(false);
}
// point is in or on triangle
return(true);
}