Assert.assertEquals(p0.inverse().transform(
new GeneralDirectPosition(new double[] { 0.5 }), null)
.getOrdinate(0), 0.5, 0.0);
Assert.assertEquals(p0.derivative(1.0), 1.0, 0.0);
final DirectPosition1D inDP = new DirectPosition1D(0.6);
final DirectPosition outDP= p0.transform(inDP, null);
Assert.assertTrue(outDP.getOrdinate(0)==0.6);
try{
p0.transform(new double[]{0.5},0,(double[])null,0,0);
Assert.assertFalse(true);
}
catch (UnsupportedOperationException e) {
// TODO: handle exception
}
try{
p0.transform(new float[]{0.5f},0,(float[])null,0,0);
Assert.assertFalse(true);
}
catch (UnsupportedOperationException e) {
// TODO: handle exception
}
try{
p0.toWKT();
Assert.assertFalse(true);
}
catch (UnsupportedOperationException e) {
// TODO: handle exception
}
Matrix m= p0.derivative(inDP);
Assert.assertTrue(m.getNumCol()==1);
Assert.assertTrue(m.getNumRow()==1);
Assert.assertTrue(m.getElement(0, 0)==1);
////
//
//testing the transform
//
////
final DefaultPiecewiseTransform1D<DefaultPiecewiseTransform1DElement> piecewise =
new DefaultPiecewiseTransform1D<DefaultPiecewiseTransform1DElement>(new DefaultPiecewiseTransform1DElement[] { p0 },11);
Assert.assertEquals(piecewise.getApproximateDomainRange().getMinimum(), 0.0, 0.0);
Assert.assertEquals(piecewise.getApproximateDomainRange().getMaximum(), 1.0, 0.0);
Assert.assertEquals(piecewise.transform(0.5), 0.5, 0.0);
Assert.assertEquals(piecewise.transform(
new GeneralDirectPosition(new double[] { 0.5 }), null)
.getOrdinate(0), 0.5, 0.0);
Assert.assertEquals(piecewise.transform(1.5), 0.0, 11.0);
try{
piecewise.transform(new double[]{0.5},0,(double[])null,0,0);
Assert.assertFalse(true);
}
catch (UnsupportedOperationException e) {
// TODO: handle exception
}
try{
piecewise.transform(new float[]{0.5f},0,(float[])null,0,0);
Assert.assertFalse(true);
}
catch (UnsupportedOperationException e) {
// TODO: handle exception
}
try{
piecewise.toWKT();
Assert.assertFalse(true);
}
catch (UnsupportedOperationException e) {
// TODO: handle exception
}
try{
m= piecewise.derivative(inDP);
Assert.assertFalse(true);
}
catch (UnsupportedOperationException e) {
// TODO: handle exception
}
////
//
//testing the passthrough through indirect instantion
//
////
final DefaultPassthroughPiecewiseTransform1DElement p1 = new DefaultPassthroughPiecewiseTransform1DElement(
"p1");
Assert.assertEquals(p1.getTargetDimensions(), 1);
Assert.assertEquals(p1.getSourceDimensions(), 1);
Assert.assertTrue(p1.isIdentity());
Assert.assertEquals(p1.inverse(), LinearTransform1D.IDENTITY);
Assert.assertEquals(p1.transform(0.5), 0.5, 0.0);
Assert.assertEquals(p1.transform(111.5), 111.5, 0.0);
Assert.assertEquals(p1.transform(
new GeneralDirectPosition(new double[] { 123.5 }), null)
.getOrdinate(0), 123.5, 0.0);
Assert.assertEquals(p1.inverse().transform(
new GeneralDirectPosition(new double[] { 657.5 }), null)
.getOrdinate(0), 657.5, 0.0);
Assert.assertEquals(p1.derivative(1.0), 1.0, 0.0);
final DirectPosition1D inDP1 = new DirectPosition1D(0.6);
final DirectPosition outDP1= p1.transform(inDP1, null);
Assert.assertTrue(outDP1.getOrdinate(0)==0.6);
try{
p1.transform(new double[]{1233444.5},0,(double[])null,0,0);
Assert.assertFalse(true);
}