Ejemplo n.º 1
0
        public static bool Crosses(this Ray2 ray, Rectangle rectangle, out float near, out float far)
        {
            Point2            center            = new Point2(rectangle.X + rectangle.Width / 2, rectangle.Y + rectangle.Height / 2);
            Size2             halfExtents       = new Size2(rectangle.Width / 2, rectangle.Height / 2);
            BoundingRectangle boundingRectangle = new BoundingRectangle(center, halfExtents);

            return(ray.Crosses(boundingRectangle, out near, out far));
        }