示例#1
0
        public static bool Contains2DPoint(Vector2 point, Vector2 quadCenter, float quadWidth, float quadHeight, Vector2 quadRight,
                                           Vector2 quadUp, QuadEpsilon epsilon = new QuadEpsilon())
        {
            quadWidth  += epsilon.WidthEps;
            quadHeight += epsilon.HeightEps;

            Vector2 toPoint  = point - quadCenter;
            float   dotRight = toPoint.AbsDot(quadRight);
            float   dotUp    = toPoint.AbsDot(quadUp);

            if (dotRight > quadWidth * 0.5f)
            {
                return(false);
            }
            if (dotUp > quadHeight * 0.5f)
            {
                return(false);
            }

            return(true);
        }