Esempio n. 1
0
        /// <summary>
        /// Can Triangulation bypass the need to compute the ful distance?
        ///
        /// THis method is only used for testing.
        /// </summary>
        /// <param name="other">Other.</param>
        /// <param name="squareDistance">Square distance.</param>
        public bool Triangulatable(UnsignedPoint other, long squareDistance)
        {
            var hPoint = other as HilbertPoint;

            if (hPoint == null)
            {
                return(false);
            }
            if (Triangulation.ArePointsFartherForSure(hPoint.Triangulation, squareDistance))
            {
                return(true);
            }
            if (Triangulation.ArePointsNearerForSure(hPoint.Triangulation, squareDistance))
            {
                return(true);
            }
            return(false);
        }
Esempio n. 2
0
        public override int SquareDistanceCompare(UnsignedPoint other, long squareDistance)
        {
            var hPoint = other as HilbertPoint;

            if (hPoint == null)
            {
                return(base.SquareDistanceCompare(other, squareDistance));
            }
            if (Triangulation.ArePointsFartherForSure(hPoint.Triangulation, squareDistance))
            {
                return(1);
            }
            if (Triangulation.ArePointsNearerForSure(hPoint.Triangulation, squareDistance))
            {
                return(-1);
            }
            return(Measure(other).CompareTo(squareDistance));
        }