예제 #1
0
 /**
  * After a call to {@code transform}, applies the <em>inverse</em> transform on {@code dstPts} and
  * compares the result with {@code srcPts}. The maximal difference (in absolute value) is
  * returned. This method is used for assertions.
  */
 private float maxError(
     final float[] srcPts1,
     final double[] srcPts2,
     int srcOff,
     final float[] dstPts1,
     final double[] dstPts2,
     int dstOff,
     int numPts) {
   float max = 0f;
   if (inverse == null) {
     inverse();
     if (inverse == null) {
       return max; // Custom user's subclass; can't do the test.
     }
   }
   final int sourceDim = getSourceDimensions();
   final float[] tmp = new float[numPts * sourceDim];
   inverse.transform(dstPts1, dstPts2, dstOff, tmp, null, 0, numPts);
   for (int i = 0; i < tmp.length; i++, srcOff++) {
     final float expected = (srcPts2 != null) ? (float) srcPts2[srcOff] : srcPts1[srcOff];
     float error = abs(tmp[i] - expected);
     switch (i % sourceDim) {
       case 0:
         error -= 360 * floor(error / 360);
         break; // Rool Longitude
       case 2:
         continue; // Ignore height because inacurate.
     }
     if (error > max) {
       max = error;
     }
   }
   return max;
 }
예제 #2
0
 /** Creates the inverse transform of this object. */
 @Override
 public MathTransform inverse() {
   if (inverse == null) {
     inverse =
         new MolodenskiTransform(
             abridged, a + da, b + db, target3D, a, b, source3D, -dx, -dy, -dz);
     inverse.inverse = this;
   }
   return inverse;
 }