private double[] getTransformedCoordinate( ICRS inputCRS, double[] inputCoordinate ) throws TransformationException, UnknownCRSException { if ( inputCRS != null && outputCRS != null && !inputCRS.equals( outputCRS ) ) { if ( transformer == null ) { throw new UnknownCRSException( outputCRS.getAlias() ); } double[] out = transformer.transform( inputCRS, inputCoordinate, transformedOrdinates ); return out; } return inputCoordinate; }
private double[] getTransformedCoordinate( ICRS inputCRS, double[] inputCoordinate ) throws TransformationException, UnknownCRSException { if ( inputCRS != null && outputCRS != null && !inputCRS.equals( outputCRS ) ) { if ( transformer == null ) { throw new UnknownCRSException( outputCRS.getAlias() ); } double[] out = transformer.transform( inputCRS, inputCoordinate, transformedOrdinates ); return out; } return inputCoordinate; }
private List<Point3d> transformDstToSrc( ICRS srcCRS, List<Point3d> points ) throws TransformationException { // transform all grid points return new CoordinateTransformer( srcCRS ).transform( getTargetCRS(), points ); }
points = t.transform( defWGS, points ); axis0Min = Double.MAX_VALUE; axis1Min = Double.MAX_VALUE;
/** * This method transforms the given coordinate (in the sourceCRS) into a coordinate of the targetCRS and back. * * @param coordinate * to be transformed. * @param withInverse * true if the inverse has to be calculated. * @throws TransformationException * @throws IllegalArgumentException * @throws UnknownCRSException */ public void doTransform( double[] coordinate, boolean withInverse ) throws IllegalArgumentException, TransformationException, UnknownCRSException { CoordinateTransformer ct = new CoordinateTransformer( targetCRS ); double[] in = Arrays.copyOf( coordinate, 3 ); // point to transform double[] out = new double[3]; outputPoint( "The original point in crs: " + sourceCRS.getAlias() + ": ", in, sourceCRS ); ct.transform( sourceCRS, in, out ); outputPoint( "The transformed point in crs: " + targetCRS.getAlias() + ": ", out, targetCRS ); if ( withInverse ) { // transform back to source CRS ct = new CoordinateTransformer( sourceCRS ); double[] nIn = new double[3]; ct.transform( targetCRS, out, nIn ); outputPoint( "The inversed transformed point in crs: " + sourceCRS.getAlias() + ": ", nIn, sourceCRS ); } }