Exemplo n.º 1
0
        internal static float GetScale(DenseMatrix matrix)
        {
            _points[0] = 0;
            _points[1] = 0;
            // Use sqrt(2) so that the hypotenuse is of length 1.
            _points[2] = Sqrt2;
            _points[3] = Sqrt2;
            matrix.MapPoints(ref _points);
            var dx = _points[2] - _points[0];
            var dy = _points[3] - _points[1];

            // TODO: figure out why the result needs to be divided by 2.
            return((float)MathExt.Hypot(dx, dy) / 2f);
        }
Exemplo n.º 2
0
        internal static float GetScale(Matrix3X3 matrix)
        {
            _points[0].X = 0;
            _points[0].Y = 0;
            _points[1].X = Sqrt2;
            _points[1].Y = Sqrt2;
            // Use sqrt(2) so that the hypotenuse is of length 1.
            matrix.MapPoints(ref _points);
            var dx = _points[1].X - _points[0].X;
            var dy = _points[1].Y - _points[0].Y;

            // TODO: figure out why the result needs to be divided by 2.
            return((float)MathExt.Hypot(dx, dy) / 2f);
        }