コード例 #1
0
 // copy constructor
 public RectangleR(RectangleR r)
 {
     _x      = r.X;
     _y      = r.Y;
     _width  = r.Width;
     _height = r.Height;
 }
コード例 #2
0
        // scales the points so that the length of their shorter side
        // matches the length of the shorter side of the given box.
        // thus, both dimensions are warped proportionally, rather than
        // independently, like in the function ScaleTo.
        //public static ArrayList ScaleToMin(ArrayList points, RectangleR box)
        public static List <PointR> ScaleToMin(List <PointR> points, RectangleR box)
        {
            //ArrayList newPoints = new ArrayList(points.Count);
            var newPoints = new List <PointR>(points.Count);
            var r         = FindBox(points);

            for (var i = 0; i < points.Count; i++)
            {
                var p = points[i];
                p.X *= (box.MinSide / r.MinSide);
                p.Y *= (box.MinSide / r.MinSide);
                newPoints.Add(p);
            }
            return(newPoints);
        }