@Override public LatLonGeo toLatLonGeo( LatLonRect from ) { return toLatLonGeo( from.getX( ), from.getY( ), from.getZ( ) ); }
public LatLonGeo toLatLonGeo( LatLonRect from ) { return SpheroidUtil.toLatLonGeo( from.getX( ), from.getY( ), from.getZ( ), this ); }
/** * Computes the (east,north,up) representation of an ECEF-r point * given the underlying projection plane's point of tangency. * * @param point ECEF-r point to be transformed to (east,north,up) coordinates * @param refPoint local tangent plane point of tangency * @return (x,y,z) which correspond to (east, north, up) in system units */ public Vector3d toEnu( LatLonRect point, LatLonGeo refPoint ) { LatLonRect refPointRect = refPoint.toLatLonRect( this ); // catastrophic cancellation: cleverness needed to maintain precision final double dx = point.getX( ) - refPointRect.getX( ); final double dy = point.getY( ) - refPointRect.getY( ); final double dz = point.getZ( ) - refPointRect.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 e = -sinLon * dx + cosLon * dy + 0 * dz; final double n = -sinLat * cosLon * dx - sinLat * sinLon * dy + cosLat * dz; final double u = cosLat * cosLon * dx + cosLat * sinLon * dy + sinLat * dz; return new Vector3d( e, n, u ); }
/** * 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 ); }