/** * Transformation from ECEF-g to ECEF-r coordinates. */ public static LatLonRect toLatLonRect( double northLatRad, double eastLonRad, double altitude, double radius ) { final double sinLat = Math.sin( northLatRad ); final double cosLat = Math.cos( northLatRad ); final double sinLon = Math.sin( eastLonRad ); final double cosLon = Math.cos( eastLonRad ); final double x = ( radius + altitude ) * cosLat * cosLon; final double y = ( radius + altitude ) * cosLat * sinLon; final double z = ( radius + altitude ) * sinLat; return LatLonRect.fromXyz( x, y, z ); }
/** * Transformation from ECEF-g to ECEF-r coordinates. */ public static LatLonRect toLatLonRect( double northLatRad, double eastLonRad, double altitude, Datum d ) { final double a = d.getEquatorialRadius( ); final double e2 = d.getEccentricitySquared( ); final double sinLat = Math.sin( northLatRad ); final double cosLat = Math.cos( northLatRad ); final double sinLon = Math.sin( eastLonRad ); final double cosLon = Math.cos( eastLonRad ); final double N = a / Math.sqrt( 1d - e2 * sinLat * sinLat ); final double x = ( N + altitude ) * cosLat * cosLon; final double y = ( N + altitude ) * cosLat * sinLon; final double z = ( altitude + ( 1d - e2 ) * N ) * sinLat; return LatLonRect.fromXyz( x, y, z ); }
/** * Computes the ECEF-r representation of the given (east,north,up) * vector given the underlying projection plane's point of tangency. * * @param enuPoint (east,north,up) coordinates of point to be converted, in system units * @param refPoint local tangent plane point of tangency * @return ECEF-r representation of the input (east,north,up) point */ public LatLonRect fromEnu( Vector3d enuPoint, LatLonGeo refPoint ) { final double e = enuPoint.getX( ); final double n = enuPoint.getY( ); final double u = enuPoint.getZ( ); final double sinLat = Math.sin( refPoint.getLatRad( ) ); final double cosLat = Math.cos( refPoint.getLatRad( ) ); final double sinLon = Math.sin( refPoint.getLonRad( ) ); final double cosLon = Math.cos( refPoint.getLonRad( ) ); final double dx = -sinLon * e - cosLon * sinLat * n + cosLon * cosLat * u; final double dy = cosLon * e - sinLon * sinLat * n + sinLon * cosLat * u; final double dz = 0 * e + cosLat * n + sinLat * u; LatLonRect refPointRect = refPoint.toLatLonRect( this ); return LatLonRect.fromXyz( refPointRect.getX( ) + dx, refPointRect.getY( ) + dy, refPointRect.getZ( ) + dz ); }
public LatLonGeo estimateCenterLatLon( ) { if ( _registrationPoints.size( ) == 0 ) return null; StatCollectorNDim center = new StatCollectorNDim( 3 ); for ( Pair<IntPoint2d, LatLonGeo> pair : _registrationPoints ) { LatLonRect posit = pair.second( ).toLatLonRect( wgs84sphere ); center.addElement( new double[] { posit.getX( ), posit.getY( ), posit.getZ( ) } ); } double[] centerXYZ = center.getMean( ); LatLonRect centerLLR = LatLonRect.fromXyz( centerXYZ[0], centerXYZ[1], centerXYZ[2] ); return centerLLR.toLatLonGeo( wgs84sphere ); }