Exemplo n.º 1
0
    public static bool IsINRect(Vector3 point, Vector3 v0, Vector3 v1, Vector3 v2, Vector3 v3)
    {
        float x  = point.x;
        float z  = point.z;
        float x2 = v0.x;
        float z2 = v0.z;
        float x3 = v1.x;
        float z3 = v1.z;
        float x4 = v2.x;
        float z4 = v2.z;
        float x5 = v3.x;
        float z5 = v3.z;

        return(XUtility.Multiply(x, z, x2, z2, x3, z3) * XUtility.Multiply(x, z, x5, z5, x4, z4) <= 0f && XUtility.Multiply(x, z, x5, z5, x2, z2) * XUtility.Multiply(x, z, x4, z4, x3, z3) <= 0f);
    }