示例#1
0
        public static Rect2d FromBoundingBox(params Vector2d[] pointList)
        {
            if (pointList.Length == 0)
            {
                return(new Rect2d());
            }

            Rect2d rect = Rect2d.FromCenterAndSize(pointList[0], new Vector2d(0));

            foreach (var point in pointList.Skip(1))
            {
                rect.left   = System.Math.Min(rect.left, point.X);
                rect.right  = System.Math.Max(rect.right, point.X);
                rect.top    = System.Math.Min(rect.top, point.Y);
                rect.bottom = System.Math.Max(rect.bottom, point.Y);
            }
            return(rect);
        }
示例#2
0
 public static Rect2d FromCenterAndSize(Vector2d center, double width, double height)
 {
     return(Rect2d.FromCenterAndSize(center, new Vector2d(width, height)));
 }
示例#3
0
 public static Rect2d FromCenterAndSize(double centerX, double centerY, Vector2d size)
 {
     return(Rect2d.FromCenterAndSize(new Vector2d(centerX, centerY), size));
 }
示例#4
0
 public static Rect2d FromCenterAndSize(double centerX, double centerY, double width, double height)
 {
     return(Rect2d.FromCenterAndSize(new Vector2d(centerX, centerY), new Vector2d(width, height)));
 }