public MathTransformation inverseTransform() { if (inverse == null) { if (isIdentity()) { inverse = this; } else if (scale != 0) { final SingleDimensionTransformation inverse; inverse = create(1 / scale, -offset / scale); inverse.inverse = this; this.inverse = inverse; } else { throw new UnsupportedOperationException("Unable to invert such transformation"); } } return inverse; }
/** * Retrieves the offset factor for this linear {@link PiecewiseTransform1DElement}. * * @return the offset factor for this linear {@link PiecewiseTransform1DElement}. */ public double getOffset() { // get the transform at this point it is linear for sure final SingleDimensionTransformation transform = (SingleDimensionTransformation) getTransform(); return transform.getOffset(); }
/** * Retrieves the scale factor for this linear {@link PiecewiseTransform1DElement}. * * @return the scale factor for this linear {@link PiecewiseTransform1DElement}. */ public double getScale() { // get the transform at this point it is linear for sure final SingleDimensionTransformation transform = (SingleDimensionTransformation) getTransform(); return transform.getScale(); }
setTransform(SingleDimensionTransformation.create(0, outputMinimum)); setInverse(SingleDimensionTransformation.create(outputMinimum, 0)); return; } else assert !Double.isNaN(((SingleDimensionTransformation) transform).getScale()) && !Double.isInfinite(((SingleDimensionTransformation) transform).getScale()); final double scale = tempTransform.getScale(); if (Math.abs(scale) < 1E-6) if (PiecewiseUtilities.compare(getInputMaximum(), getInputMinimum()) == 0) setInverse(SingleDimensionTransformation.create(0, getInputMinimum())); else setInverse(null);
/** * Returns a linear transform with the supplied scale and offset values. * * @param scale The scale factor. May be 0 for a constant transform. * @param offset The offset value. May be NaN. */ public static MathTransformation createLinearTransform1D(final double scale, final double offset) { return SingleDimensionTransformation.create(scale, offset); }
public Position transform(Position ptSrc, Position ptDst) { if (ptDst == null) { ptDst = new Position(); } ptDst.setOrdinatePosition(transform(ptSrc.getOrdinatePosition())); return ptDst; }
public boolean isIdentity() { return isIdentity(0); }
/** * Creates a {@link SingleDimensionTransformation} instance based on the input scale and offset * * @param scale * @param offset * @return */ public static SingleDimensionTransformation create(double scale, double offset) { if (scale == 0) { return new ConstantTransform(offset); } if (scale == 1 && offset == 0) { return IDENTITY; } return new SingleDimensionTransformation(scale, offset); }
setTransform(SingleDimensionTransformation.create(0, outputMinimum)); setInverse(SingleDimensionTransformation.create(outputMinimum, 0)); return; } else assert !Double.isNaN(((SingleDimensionTransformation) transform).getScale()) && !Double.isInfinite(((SingleDimensionTransformation) transform).getScale()); final double scale = tempTransform.getScale(); if (Math.abs(scale) < 1E-6) if (PiecewiseUtilities.compare(getInputMaximum(), getInputMinimum()) == 0) setInverse(SingleDimensionTransformation.create(0, getInputMinimum())); else setInverse(null);
/** * Returns a linear transform with the supplied scale and offset values. * * @param scale The scale factor. May be 0 for a constant transform. * @param offset The offset value. May be NaN. */ public static MathTransformation createLinearTransform1D(final double scale, final double offset) { return SingleDimensionTransformation.create(scale, offset); }
public Position transform(Position ptSrc, Position ptDst) { if (ptDst == null) { ptDst = new Position(); } ptDst.setOrdinatePosition(transform(ptSrc.getOrdinatePosition())); return ptDst; }
public boolean isIdentity() { return isIdentity(0); }
/** * Creates a {@link SingleDimensionTransformation} instance based on the input scale and offset * * @param scale * @param offset * @return */ public static SingleDimensionTransformation create(double scale, double offset) { if (scale == 0) { return new ConstantTransform(offset); } if (scale == 1 && offset == 0) { return IDENTITY; } return new SingleDimensionTransformation(scale, offset); }
public MathTransformation inverseTransform() { if (inverse == null) { if (isIdentity()) { inverse = this; } else if (scale != 0) { final SingleDimensionTransformation inverse; inverse = create(1 / scale, -offset / scale); inverse.inverse = this; this.inverse = inverse; } else { throw new UnsupportedOperationException("Unable to invert such transformation"); } } return inverse; }
/** * The transformation we are specifying here is not always invertible, well, to be honest, strictly speaking it never really is. However when the * underlying transformation is a 1:1 mapping we can invert it. */ public MathTransformation inverse() throws NoninvertibleTransformException { if (this.getInputMinimum() == getInputMaximum()) return SingleDimensionTransformation.create(0, getInputMinimum()); throw new UnsupportedOperationException( "Inverse operation is unsupported for Constant Transform"); }
/** * Retrieves the scale factor for this linear {@link PiecewiseTransform1DElement}. * * @return the scale factor for this linear {@link PiecewiseTransform1DElement}. */ public double getScale() { // get the transform at this point it is linear for sure final SingleDimensionTransformation transform = (SingleDimensionTransformation) getTransform(); return transform.getScale(); }
/** * Retrieves the offset factor for this linear {@link PiecewiseTransform1DElement}. * * @return the offset factor for this linear {@link PiecewiseTransform1DElement}. */ public double getOffset() { // get the transform at this point it is linear for sure final SingleDimensionTransformation transform = (SingleDimensionTransformation) getTransform(); return transform.getOffset(); }
/** * The transformation we are specifying here is not always invertible, well, to be honest, strictly speaking it never really is. However when the * underlying transformation is a 1:1 mapping we can invert it. */ public MathTransformation inverse() throws NoninvertibleTransformException { if (this.getInputMinimum() == getInputMaximum()) return SingleDimensionTransformation.create(0, getInputMinimum()); throw new UnsupportedOperationException( "Inverse operation is unsupported for Constant Transform"); }
return SingleDimensionTransformation.create(0, minDestination);
return SingleDimensionTransformation.create(0, minDestination);