Nez.Vector2Ext.cross C# (CSharp) Méthode

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 float cross( Vector2 u, Vector2 v )
		{
			return u.Y * v.X - u.X * v.Y;
		}

Usage Example

        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);
        }
All Usage Examples Of Nez.Vector2Ext::cross