public final LatLonRect scale( double by ) { return new LatLonRect( xUnit, yUnit, zUnit, length * by ); }
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 ); }
/** * 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 ); }
/** * Constructs and initializes a <code>LatLonGeo</code> based on the given * (east,north,up) coordinates in a local tangent plane coordinate system that is * tangent to Earth at the given reference point. * * @param enuPoint (east,north,up) coordinates of point to be converted, in system units * @param refPoint local tangent plane point of tangency * @param datum underlying datum used for calculations */ public static final LatLonGeo fromEnu( Vector3d enuPoint, LatLonGeo refPoint, Datum datum ) { LatLonRect llr = datum.fromEnu( enuPoint, refPoint ); LatLonGeo llg = llr.toLatLonGeo( datum ); return llg; }
/** * 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 ); }
/** * 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 ); }
public static LatLonRect fromXyz( double x, double y, double z ) { return new LatLonRect( x, y, z ); }
/** * 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 ); }
public static final LatLonRect fromUnitVectorAndLength( double xUnit, double yUnit, double zUnit, double length ) { return new LatLonRect( xUnit, yUnit, zUnit, length ); }
public final LatLonRect withLength( double length ) { return new LatLonRect( xUnit, yUnit, zUnit, length ); }