public void testGetCoordinatesBetweenNonStrict() {
    try {
      CoordinateSequenceComparator coordCompare = new CoordinateSequenceComparator();
      MCoordinate mc0 = MCoordinate.create2dWithMeasure(0.0, 0.0, 0);
      MCoordinate mc1 = MCoordinate.create2dWithMeasure(0.0, 1.0, 1);
      MCoordinate mc2_1 = MCoordinate.create2dWithMeasure(0.0, 2.0, 1);
      MCoordinate mc2 = MCoordinate.create2dWithMeasure(0.0, 2.0, 2);
      MCoordinate mc3 = MCoordinate.create2dWithMeasure(0.0, 3.0, 3);
      MCoordinate mc4 = MCoordinate.create2dWithMeasure(0.0, 4.0, 4);

      // Test non-strict sequence where all coordinate x,y positions are
      // unique, but contains a
      // duplicate measure. The measure sequence in this testsuite-suite s
      // [0,1,1,3,4]
      MLineString nonStrictPointLine =
          mgeomFactory.createMLineString(new MCoordinate[] {mc0, mc1, mc2_1, mc3, mc4});
      CoordinateSequence[] nonStrictSeq = nonStrictPointLine.getCoordinatesBetween(mc0.m, mc2_1.m);
      assertNotNull(nonStrictSeq);

      nonStrictSeq = nonStrictPointLine.getCoordinatesBetween(mc0.m, mc4.m);
      assertNotNull(nonStrictSeq);

      nonStrictSeq = nonStrictPointLine.getCoordinatesBetween(mc1.m, mc4.m);
      assertNotNull(nonStrictSeq);

      nonStrictSeq = nonStrictPointLine.getCoordinatesBetween(1.1D, mc4.m);
      assertNotNull(nonStrictSeq);

    } catch (MGeometryException e) {
      e.printStackTrace();
    }
  }
  public void testGetCoordinatesBetween() {

    try {
      // what if the null value is passed
      CoordinateSequence[] cs = nullLine.getCoordinatesBetween(0.0, 5.0);
      assertTrue("cs.length = " + cs.length + ". Should be 1", cs.length == 1);
      assertEquals(cs[0].size(), 0);

      arbitraryLine.measureOnLength(false);
      // what if from/to is outside of the range of values
      double maxM = arbitraryLine.getMaxM();
      cs = arbitraryLine.getCoordinatesBetween(maxM + 1.0, maxM + 10.0);

      // check for several ascending M-values
      int minIdx = (int) (Math.random() * (arbitraryLine.getNumPoints() - 1));
      int maxIdx = Math.min((arbitraryLine.getNumPoints() - 1), minIdx + 10);
      double minM = ((MCoordinate) arbitraryLine.getCoordinateN(minIdx)).m;
      maxM = ((MCoordinate) arbitraryLine.getCoordinateN(maxIdx)).m;
      cs = arbitraryLine.getCoordinatesBetween(minM, maxM);
      assertNotNull(cs);
      assertTrue(cs.length > 0);
      Coordinate[] coar = cs[0].toCoordinateArray();
      int j = 0;
      for (int i = minIdx; i <= maxIdx; i++) {
        assertEquals((MCoordinate) arbitraryLine.getCoordinateN(i), coar[j]);
        j++;
      }

      minM = Math.max(0.0, minM - Math.random() * 10);
      cs = arbitraryLine.getCoordinatesBetween(minM, maxM);
      coar = cs[0].toCoordinateArray();
      MCoordinate mctest = (MCoordinate) coar[0];
      MCoordinate mcexp = (MCoordinate) arbitraryLine.getCoordinateAtM(minM);
      assertEquals(mcexp, mctest);
      assertEquals(mctest.m, minM, DoubleComparator.defaultNumericalPrecision());

      maxM = Math.min(arbitraryLine.getLength(), maxM + Math.random() * 10);
      cs = arbitraryLine.getCoordinatesBetween(minM, maxM);
      coar = cs[0].toCoordinateArray();
      mctest = (MCoordinate) coar[coar.length - 1];
      mcexp = (MCoordinate) arbitraryLine.getCoordinateAtM(maxM);
      assertEquals(mcexp.x, mctest.x, Math.ulp(mcexp.x) * 100);
      assertEquals(mcexp.y, mctest.y, Math.ulp(mcexp.y) * 100);
      assertEquals(mctest.m, maxM, DoubleComparator.defaultNumericalPrecision());

    } catch (Exception e) {
      e.printStackTrace();
      assertTrue(false); // should never reach here
    }
  }