Exemple #1
0
        public static void GetRefitTransform(IEnumerable <Vector64> points, Rect64 target, bool stretch, out Vector64 scale, out Vector64 shift)
        {
            Rect64 bds = GetBounds(points);

            scale = new Vector64(target.Width() / bds.Width(), target.Height() / bds.Height());

            if (!stretch)
            {
                double s = Math.Min(scale.X, scale.Y);
                scale = new Vector64(s, s);
            }

            shift = new Vector64(-bds.left, -bds.bottom) * scale
                    + new Vector64(Math.Min(target.left, target.right), Math.Min(target.bottom, target.top));
        }