Esempio n. 1
0
 /**
  * Calculates whether the measures in the CoordinateSequence are monotone
  * and strict monotone. The strict parameter indicates whether the
  * determination should apply the definition of "strict monotonicity" or
  * non-strict.
  *
  * @see #IsMonotone()
  * @see #isStrictMonotone()
  */
 private void DetermineMonotone()
 {
     this.monotone       = true;
     this.strictMonotone = true;
     if (!this.IsEmpty)
     {
         double[] m = this.GetMeasures();
         // short circuit if the first value is NaN
         if (Double.IsNaN(m[0]))
         {
             this.monotone       = false;
             this.strictMonotone = false;
         }
         else
         {
             int result     = 0;
             int prevResult = 0;
             for (int i = 1; i < m.Length && this.monotone; i++)
             {
                 result               = DoubleComparator.Compare(m[i - 1], m[i]);
                 this.monotone        = !(result * prevResult < 0 || Double.IsNaN(m[i]));
                 this.strictMonotone &= this.monotone && result != 0;
                 prevResult           = result;
             }
         }
     }
     // if not monotone, then certainly not strictly monotone
     Debug.Assert(!(this.strictMonotone && !this.monotone));
 }
Esempio n. 2
0
        public bool Equals3DWithMeasure(Coordinate other)
        {
            bool result = this.Equals3D(other);

            if (result)
            {
                MCoordinate mc = ConvertCoordinate(other);
                result = (DoubleComparator.Compare(M, mc.M) == 0);
            }
            return(result);
        }