Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="env"></param>
        /// <returns></returns>
        public static int ComputeQuadLevel(Envelope env)
        {
            double dx    = env.Width;
            double dy    = env.Height;
            double dMax  = dx > dy ? dx : dy;
            int    level = DoubleBits.GetExponent(dMax) + 1;

            return(level);
        }
Beispiel #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         = System.Math.Max(System.Math.Abs(min), System.Math.Abs(max));
            double scaledInterval = width / maxAbs;
            int    level          = DoubleBits.GetExponent(scaledInterval);

            return(level <= MinBinaryExponent);
        }