InterpolatedFromCurvesDoublesSurface extends Surface<Double, Double, Double> { @Override public Double getZValue(final Double x, final Double y) { Validate.notNull(x, "x"); Validate.notNull(y, "y"); final double[] z = new double[_nCurves]; int i = 0; if (_xzCurves) { final int index = Arrays.binarySearch(_points, y); if (index < 0) { for (final Curve<Double, Double> curve : _curves) { z[i++] = curve.getYValue(x); } return InterpolatedDoublesCurve.fromSorted(_points, z, _interpolator).getYValue(y); } return _curves[index].getYValue(x); } final int index = Arrays.binarySearch(_points, x); if (index < 0) { for (final Curve<Double, Double> curve : _curves) { z[i++] = curve.getYValue(y); } return InterpolatedDoublesCurve.fromSorted(_points, z, _interpolator).getYValue(x); } return _curves[index].getYValue(y); } InterpolatedFromCurvesDoublesSurface(final boolean xzCurves, final double[] points, final Curve<Double, Double>[] curves,
      final Interpolator1D interpolator, final boolean isSorted);  InterpolatedFromCurvesDoublesSurface(final boolean xzCurves, final Double[] points, final Curve<Double, Double>[] curves,
      final Interpolator1D interpolator, final boolean isSorted); @SuppressWarnings("unchecked")  InterpolatedFromCurvesDoublesSurface(final boolean xzCurves, final List<Double> points, final List<Curve<Double, Double>> curves,
      final Interpolator1D interpolator, final boolean isSorted); @SuppressWarnings("unchecked")  InterpolatedFromCurvesDoublesSurface(final boolean xzCurves, final Map<Double, Curve<Double, Double>> curves, final Interpolator1D interpolator,
      final boolean isSorted);  InterpolatedFromCurvesDoublesSurface(final boolean xzCurves, final double[] points, final Curve<Double, Double>[] curves,
      final Interpolator1D interpolator, final boolean isSorted, final String name); @SuppressWarnings("unchecked")  InterpolatedFromCurvesDoublesSurface(final boolean xzCurves, final Double[] points, final Curve<Double, Double>[] curves,
      final Interpolator1D interpolator, final boolean isSorted, final String name); @SuppressWarnings("unchecked")  InterpolatedFromCurvesDoublesSurface(final boolean xzCurves, final List<Double> points, final List<Curve<Double, Double>> curves,
      final Interpolator1D interpolator, final boolean isSorted, final String name); @SuppressWarnings("unchecked")  InterpolatedFromCurvesDoublesSurface(final boolean xzCurves, final Map<Double, Curve<Double, Double>> curves, final Interpolator1D interpolator,
      final boolean isSorted, final String name); static InterpolatedFromCurvesDoublesSurface from(final boolean xzCurves, final double[] points, final Curve<Double, Double>[] curves,
      final Interpolator1D interpolator); static InterpolatedFromCurvesDoublesSurface from(final boolean xzCurves, final Double[] points, final Curve<Double, Double>[] curves,
      final Interpolator1D interpolator); static InterpolatedFromCurvesDoublesSurface from(final boolean xzCurves, final List<Double> points, final List<Curve<Double, Double>> curves,
      final Interpolator1D interpolator); static InterpolatedFromCurvesDoublesSurface from(final boolean xzCurves, final Map<Double, Curve<Double, Double>> curves, 
      final Interpolator1D interpolator); static InterpolatedFromCurvesDoublesSurface from(final boolean xzCurves, final double[] points, final Curve<Double, Double>[] curves,
      final Interpolator1D interpolator, final String name); static InterpolatedFromCurvesDoublesSurface from(final boolean xzCurves, final Double[] points, final Curve<Double, Double>[] curves,
      final Interpolator1D interpolator, final String name); static InterpolatedFromCurvesDoublesSurface from(final boolean xzCurves, final List<Double> points, final List<Curve<Double, Double>> curves,
      final Interpolator1D interpolator, final String name); static InterpolatedFromCurvesDoublesSurface from(final boolean xzCurves, final Map<Double, Curve<Double, Double>> curves,
      final Interpolator1D interpolator, final String name); static InterpolatedFromCurvesDoublesSurface fromSorted(final boolean xzCurves, final double[] points, final Curve<Double, Double>[] curves,
      final Interpolator1D interpolator); static InterpolatedFromCurvesDoublesSurface fromSorted(final boolean xzCurves, final Double[] points, final Curve<Double, Double>[] curves,
      final Interpolator1D interpolator); static InterpolatedFromCurvesDoublesSurface fromSorted(final boolean xzCurves, final List<Double> points, final List<Curve<Double, Double>> curves,
      final Interpolator1D interpolator); static InterpolatedFromCurvesDoublesSurface fromSorted(final boolean xzCurves, final Map<Double, Curve<Double, Double>> curves,
      final Interpolator1D interpolator); static InterpolatedFromCurvesDoublesSurface fromSorted(final boolean xzCurves, final double[] points, final Curve<Double, Double>[] curves,
      final Interpolator1D interpolator, final String name); static InterpolatedFromCurvesDoublesSurface fromSorted(final boolean xzCurves, final Double[] points, final Curve<Double, Double>[] curves,
      final Interpolator1D interpolator, final String name); static InterpolatedFromCurvesDoublesSurface fromSorted(final boolean xzCurves, final List<Double> points, final List<Curve<Double, Double>> curves,
      final Interpolator1D interpolator, final String name); static InterpolatedFromCurvesDoublesSurface fromSorted(final boolean xzCurves, final Map<Double, Curve<Double, Double>> curves,
      final Interpolator1D interpolator, final String name); @Override Double getZValue(final Double x, final Double y); @Override Double getZValue(final Pair<Double, Double> xy); @Override Double[] getXData(); @Override Double[] getYData(); @Override Double[] getZData(); @Override int size(); Interpolator1D getInterpolator(); double[] getPoints(); Curve<Double, Double>[] getCurves(); boolean isXZCurves(); @Override int hashCode(); @Override boolean equals(final Object obj);  }
@Test public void testXZCurves() { assertEquals(SURFACE.getZValue(3.5, 1.), 3., 0); assertEquals(SURFACE.getZValue(3.5, 1.5), 4., 0); assertEquals(SURFACE.getZValue(3.5, 2.), 5., 0); assertEquals(SURFACE.getZValue(3.5, 2.5), 6., 0); assertEquals(SURFACE.getZValue(3.5, 3.), 7., 0); assertEquals(SURFACE.getZValue(3.5, 3.5), 8., 0); assertEquals(SURFACE.getZValue(3.5, 4.), 9., 0); assertEquals(SURFACE.getZValue(3.5, 4.5), 10., 0); assertEquals(SURFACE.getZValue(3.5, 5.), 11., 0); assertEquals(SURFACE.getZValue(3.5, 5.5), 11.5, 0); assertEquals(SURFACE.getZValue(3.5, 6.), 12., 0); assertEquals(SURFACE.getZValue(3., 1.), 3., 0); assertEquals(SURFACE.getZValue(3., 1.5), 4., 0); assertEquals(SURFACE.getZValue(3., 2.), 5., 0); assertEquals(SURFACE.getZValue(3., 2.5), 6., 0); assertEquals(SURFACE.getZValue(3., 3.), 7., 0); assertEquals(SURFACE.getZValue(3., 3.5), 8., 0); assertEquals(SURFACE.getZValue(3., 4.), 9., 0); assertEquals(SURFACE.getZValue(3., 4.5), 10., 0); assertEquals(SURFACE.getZValue(3., 5.), 11., 0); assertEquals(SURFACE.getZValue(3., 5.5), 11.5, 0); assertEquals(SURFACE.getZValue(3., 6.), 12., 0); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullX1() { SURFACE.getZValue(null, 2.); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullY1() { SURFACE.getZValue(1., null); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullPair() { SURFACE.getZValue(null); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullX2() { SURFACE.getZValue(Pairs.of((Double) null, 2.)); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullY2() { SURFACE.getZValue(Pairs.of(1., (Double) null)); }