cross() private méthode

private cross ( Vector2 u, Vector2 v ) : float
u Microsoft.Xna.Framework.Vector2
v Microsoft.Xna.Framework.Vector2
Résultat float
        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);
        }
Exemple #2
0
 public static bool isTriangleCCW(Vector2 a, Vector2 b, Vector2 c)
 {
     return(Vector2Ext.cross(b - a, c - b) < 0);
 }