Exemplo n.º 1
0
        public static int ComputeQuadLevel(Envelope env)
        {
            double dx    = env.Width;
            double dy    = env.Height;
            double dMax  = dx > dy ? dx : dy;
            int    level = DoubleBits.Exponent(dMax) + 1;

            return(level);
        }
Exemplo n.º 2
0
        /// <summary> Computes whether the interval [min, max] is effectively zero width.
        /// I.e. the width of the interval is so much less than the
        /// location of the interval that the midpoint of the interval cannot be
        /// represented precisely.
        /// </summary>
        public static bool IsZeroWidth(double min, double max)
        {
            double width = max - min;

            if (width == 0.0)
            {
                return(true);
            }

            double maxAbs         = Math.Max(Math.Abs(min), Math.Abs(max));
            double scaledInterval = width / maxAbs;
            int    level          = DoubleBits.Exponent(scaledInterval);

            return(level <= MinBinaryExponent);
        }