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

            return(level);
        }
Пример #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.GetExponent(scaledInterval);

            return(level <= MinBinaryExponent);
        }