Example #1
0
        public RectBounds GetBounds()
        {
            RectBounds bounds = RectBounds.Empty();

            foreach (var shape in WalkAble)
            {
                bounds.Encapsulate(shape.GetBounds());
            }
            return(bounds);
        }
Example #2
0
        public static RectBounds PointsBounds(Vector2[] points)
        {
            RectBounds bounds = RectBounds.Empty();

            for (int i = 0; i < points.Length; ++i)
            {
                bounds.Encapsulate(points[i]);
            }
            return(bounds);
        }
Example #3
0
        public static RectBounds BoxBounds(Vector2 center, Vector2 rotation, Vector2 size)
        {
            RectBounds bounds = RectBounds.Empty();

            for (int i = 0; i < 4; ++i)
            {
                Vector2 point = Vector2.Scale(BoxPoints[i], size) + center;
                point = point.Rotate(rotation);
                //point = matrix.Multiply(point);
                bounds.Encapsulate(point);
            }
            return(bounds);
        }