Coverage for pygeodesy/ltp.py : 97%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# -*- coding: utf-8 -*-
I{Local cartesian} and I{local tangent plane} classes L{LocalCartesian}, approximations L{ChLVa} and L{ChLVe} and L{Ltp}, L{ChLV}, L{LocalError}, L{Attitude} and L{Frustum}.
@see: U{Local tangent plane coordinates<https://WikiPedia.org/wiki/Local_tangent_plane_coordinates>} and class L{LocalCartesian}, transcoded from I{Charles Karney}'s C++ classU{LocalCartesian <https://GeographicLib.SourceForge.io/C++/doc/classGeographicLib_1_1LocalCartesian.html>}. ''' # make sure int/int division yields float quotient, see .basics
_2_0, _60_0, _90_0, _100_0, _180_0, _3600_0, \ _N_1_0 # PYCHOK used! _invalid_, _lat0_, _lon0_, _ltp_, _M_, _name_, _too_ # from pygeodesy.lazily import _ALL_LAZY # from vector3d ChLVYX2Tuple, Footprint5Tuple, Local9Tuple, \ ChLVyx2Tuple, _XyzLocals4, _XyzLocals5, Xyz4Tuple _update_all
# from math import floor as _floor # from .fsums
# Half a field-of-view angle in C{degrees}. t = _invalid_ if f < 0 else _too_(_wide_ if f > EPS else _narrow_) raise LocalError(txt=t, **fov)
'''The orientation of a plane or camera in space. '''
'''New L{Attitude}.
@kwarg alt_attitude: An altitude (C{meter}) above earth or an attitude (L{Attitude} or L{Attitude4Tuple}) with the C{B{alt}itude}, B{C{tilt}}, B{C{yaw}} and B{C{roll}}. @kwarg tilt: Pitch, elevation from horizontal (C{degrees180}), negative down (clockwise rotation along and around the x- or East axis). @kwarg yaw: Bearing, heading (compass C{degrees360}), clockwise from North (counter-clockwise rotation along and around the z- or Up axis). @kwarg roll: Roll, bank (C{degrees180}), positive to the right and down (clockwise rotation along and around the y- or North axis). @kwarg name: Optional name C{str}).
@raise AttitudeError: Invalid B{C{alt_attitude}}, B{C{tilt}}, B{C{yaw}} or B{C{roll}}.
@see: U{Principal axes<https://WikiPedia.org/wiki/Aircraft_principal_axes>} and U{Yaw, pitch, and roll rotations<http://MSL.CS.UIUC.edu/planning/node102.html>}. ''' else: except AttributeError: raise AttitudeError(alt=alt_attitude, tilt=tilt, yaw=yaw, rol=roll)
def alt(self, alt): # PYCHOK no cover a = Meter(alt=alt, Error=AttitudeError) if self._alt != a: _update_all(self) self._alt = a
'''Return this attitude's alt[itude], tilt, yaw and roll as an L{Attitude4Tuple}. '''
'''Get the 3x3 rotation matrix C{R(yaw)·R(tilt)·R(roll)}, aka I{ZYX} (C{float}, row-order).
@see: The matrix M of case 10 in U{Appendix A <https://ntrs.NASA.gov/api/citations/19770019231/downloads/19770019231.pdf>}. '''
# to follow the definitions of rotation angles alpha, beta and gamma: # negate yaw since yaw is counter-clockwise around the z-axis, swap # tilt and roll since tilt is around the x- and roll around the y-axis (sa * cb, sa * sb * sg, ca * cg, sa * sb * cg, -ca * sg), ( -sb, cb * sg, cb * cg))
'''Transform a (local) cartesian by this attitude's matrix.
@arg x_xyz: X component of vector (C{scalar}) or (3-D) vector (C{Cartesian}, L{Vector3d} or L{Vector3Tuple}). @kwarg y: Y component of vector (C{scalar}), same units as B{C{x}}. @kwarg z: Z component of vector (C{scalar}), same units as B{C{x}}. @kwarg Vector: Class to return transformed point (C{Cartesian}, L{Vector3d} or C{Vector3Tuple}) or C{None}. @kwarg Vector_kwds: Optional, additional B{C{Vector}} keyword arguments, ignored if C{B{Vector} is None}.
@return: A B{C{Vector}} instance or a L{Vector3Tuple}C{(x, y, z)} if C{B{Vector}=None}.
@see: U{Yaw, pitch, and roll rotations<http://MSL.CS.UIUC.edu/planning/node102.html>}. ''' except AttributeError: x, y, z = map1(float, x_xyz, y, z)
Vector(X, Y, Z, **_xkwds(Vector_kwds, name=self.name))
'''Format this attitude as string.
@kwarg prec: The C{float} precision, number of decimal digits (0..9). Trailing zero decimals are stripped for B{C{prec}} values of 1 and above, but kept for negative B{C{prec}} values. @kwarg sep: Separator to join (C{str}).
@return: This attitude (C{str}). '''
'''Get this attitude's (3-D) directional vector (L{Vector3d}).
@see: U{Yaw, pitch, and roll rotations<http://MSL.CS.UIUC.edu/planning/node102.html>}. '''
'''An L{Attitude} or L{Attitude4Tuple} issue. '''
'''A rectangular pyramid, typically representing a camera's I{field-of-view} (fov) and the intersection with (or projection to) a I{local tangent plane}.
@see: U{Viewing frustum<https://WikiPedia.org/wiki/Viewing_frustum>}. '''
'''New L{Frustum}.
@arg hfov: Horizontal field-of-view (C{degrees180}). @arg vfov: Vertical field-of-view (C{degrees180}). @kwarg ltp: Optional I{local tangent plane} (L{Ltp}).
@raise LocalError: Invalid B{C{hfov}} or B{C{vfov}}. '''
self._ltp = _xLtp(ltp)
'''Compute the center and corners of the intersection with (or projection to) the I{local tangent plane} (LTP).
@arg alt_attitude: An altitude (C{meter}) above I{local tangent plane} or an attitude (L{Attitude} or L{Attitude4Tuple}) with the C{B{alt}itude}, B{C{tilt}}, B{C{yaw}} and B{C{roll}}. @kwarg tilt: Pitch, elevation from horizontal (C{degrees}), negative down (clockwise rotation along and around the x- or East axis). @kwarg yaw: Bearing, heading (compass C{degrees}), clockwise from North (counter-clockwise rotation along and around the z- or Up axis). @kwarg roll: Roll, bank (C{degrees}), positive to the right and down (clockwise rotation along and around the y- or North axis). @kwarg z: Optional height of the footprint (C{meter}) above I{local tangent plane}. @kwarg ltp: The I{local tangent plane} (L{Ltp}), overriding this frustum's C{ltp}.
@return: A L{Footprint5Tuple}C{(center, upperleft, upperight, loweright, lowerleft)} with the C{center} and 4 corners, each an L{Xyz4Tuple}.
@raise TypeError: Invalid B{C{ltp}}.
@raise UnitError: Invalid B{C{altitude}}, B{C{tilt}}, B{C{roll}} or B{C{z}}.
@raise ValueError: If B{C{altitude}} too low, B{C{z}} too high or B{C{tilt}} or B{C{roll}} -including B{C{vfov}} respectively B{C{hfov}}- over the horizon.
@see: U{Principal axes<https://WikiPedia.org/wiki/Aircraft_principal_axes>}. ''' # left and right corners, or swapped else: # roll
# rotate (x, y)'s by bearing, clockwise fsum1_(y * c, -x * s), z, ltp)
except AttributeError: a, t, y, r = alt_attitude, tilt, yaw, roll
raise _ValueError(altitude=a) if z: # PYCHOK no cover z = Meter(z=z) a -= z if a < EPS: # z above a raise _ValueError(altitude_z=a) else:
raise _ValueError(tilt=t)
# center and corners, clockwise from upperleft, rolled + _xy2(a, e + self._v_2, -self._h_2, -self._tan_h_2, r) # swapped # turn center and corners by yaw, clockwise
'''Get the horizontal C{fov} (C{degrees}). '''
'''Get the I{local tangent plane} (L{Ltp}) or C{None}. '''
'''Convert this frustum to a "hfov, vfov, ltp" string.
@kwarg prec: Number of (decimal) digits, unstripped (0..8 or C{None}). @kwarg fmt: Optional, C{float} format (C{str}). @kwarg sep: Separator to join (C{str}).
@return: Frustum in the specified form (C{str}). ''' t += self.ltp,
'''Get the vertical C{fov} (C{degrees}). '''
'''A L{LocalCartesian} or L{Ltp} related issue. '''
'''Conversion between geodetic C{(lat, lon, height)} and I{local cartesian} C{(x, y, z)} coordinates with I{geodetic} origin C{(lat0, lon0, height0)}, transcoded from I{Karney}'s C++ class U{LocalCartesian<https://GeographicLib.SourceForge.io/C++/doc/ classGeographicLib_1_1LocalCartesian.html>}.
The C{z} axis is normal to the ellipsoid, the C{y} axis points due North. The plane C{z = -height0} is tangent to the ellipsoid.
The conversions all take place via geocentric coordinates using a geocentric L{EcefKarney}, by default the WGS84 datum/ellipsoid.
@see: Class L{Ltp}. '''
'''New L{LocalCartesian} converter.
@kwarg latlonh0: The (geodetic) origin (C{LatLon}, L{LatLon4Tuple}, L{Ltp} or L{Ecef9Tuple}) or latitude of the (goedetic) origin (C{degrees}). @kwarg lon0: Optional longitude of the (goedetic) origin for C{scalar} B{C{latlonh0}} and B{C{height0}} (C{degrees}). @kwarg height0: Optional origin height (C{meter}), vertically above (or below) the surface of the ellipsoid. @kwarg ecef: An ECEF converter (L{EcefKarney} I{only}). @kwarg name: Optional name (C{str}).
@raise LocalError: If B{C{latlonh0}} not C{LatLon}, L{LatLon4Tuple}, L{Ltp} or L{Ecef9Tuple} or B{C{latlonh0}}, B{C{lon0}} or B{C{height0}} invalid, non-C{scalar}.
@raise TypeError: Invalid B{C{ecef}} or not L{EcefKarney}.
@note: If BC{latlonh0} is an L{Ltp}, only the lat-, longitude and height are duplicated, I{not} the ECEF converter. ''' else: if ecef: # PYCHOK no cover _xinstanceof(EcefKarney, ecef=ecef) self._ecef = ecef
'''Compare this and an other instance.
@arg other: The other ellipsoid (L{LocalCartesian} or L{Ltp}).
@return: C{True} if equal, C{False} otherwise. ''' return other is self or (isinstance(other, self.__class__) and other.ecef == self.ecef and other._t0 == self._t0)
'''Get the ECEF converter's datum (L{Datum}). '''
'''Get the ECEF converter (L{EcefKarney}). '''
'''(INTERNAL) Convert geocentric/geodetic to local, like I{forward}.
@arg ecef: Geocentric (and geodetic) (L{Ecef9Tuple}). @arg Xyz: An L{XyzLocal}, L{Enu} or L{Ned} I{class} or C{None}. @arg Xyz_kwds: B{C{Xyz}} keyword arguments, ignored if C{B{Xyz} is None}.
@return: An C{B{Xyz}(x, y, z, ltp, **B{Xyz_kwds}} instance or if C{B{Xyz} is None}, a L{Local9Tuple}C{(x, y, z, lat, lon, height, ltp, ecef, M)} with this C{ltp}, B{C{ecef}} (L{Ecef9Tuple}) converted to this C{datum} and C{M=None}, always. ''' ecef = ecef.toDatum(ltp.datum) ltp, ecef, None, name=ecef.name) raise _TypesError(_Xyz_, Xyz, *_XyzLocals4)
'''Convert I{geodetic} C{(lat, lon, height)} to I{local} cartesian C{(x, y, z)}.
@arg latlonh: Either a C{LatLon}, an L{Ltp}, an L{Ecef9Tuple} or C{scalar} (geodetic) latitude (C{degrees}). @kwarg lon: Optional C{scalar} (geodetic) longitude for C{scalar} B{C{latlonh}} (C{degrees}). @kwarg height: Optional height (C{meter}), vertically above (or below) the surface of the ellipsoid. @kwarg M: Optionally, return the I{concatenated} rotation L{EcefMatrix}, iff available (C{bool}). @kwarg name: Optional name (C{str}).
@return: A L{Local9Tuple}C{(x, y, z, lat, lon, height, ltp, ecef, M)} with I{local} C{x}, C{y}, C{z}, I{geodetic} C{(lat}, C{lon}, C{height}, this C{ltp}, C{ecef} (L{Ecef9Tuple}) with I{geocentric} C{x}, C{y}, C{z} (and I{geodetic} C{lat}, C{lon}, C{height}) and the I{concatenated} rotation matrix C{M} (L{EcefMatrix}) if requested.
@raise LocalError: If B{C{latlonh}} not C{scalar}, C{LatLon}, L{Ltp}, L{Ecef9Tuple} or invalid or if B{C{lon}} not C{scalar} for C{scalar} B{C{latlonh}} or invalid or if B{C{height}} invalid. '''
'''Get origin's height (C{meter}). '''
'''Get origin's latitude (C{degrees}). '''
'''Get the origin's lat-, longitude and height (L{LatLon3Tuple}C{(lat, lon, height)}). ''' return LatLon3Tuple(self.lat0, self.lon0, self.height0, name=self.name)
'''(INTERNAL) Convert I{local} to geocentric/geodetic, like I{.reverse}.
@arg local: Local (L{XyzLocal}, L{Enu}, L{Ned}, L{Aer} or L{Local9Tuple}). @kwarg nine: Return 3- or 9-tuple (C{bool}). @kwarg M: Include the rotation matrix (C{bool}).
@return: A I{geocentric} 3-tuple C{(x, y, z)} or if C{B{nine}=True}, an L{Ecef9Tuple}C{(x, y, z, lat, lon, height, C, M, datum)}, optionally including rotation matrix C{M} or C{None}. '''
'''Get origin's longitude (C{degrees}). '''
'''Get the rotation matrix (C{EcefMatrix}). '''
'''Reset the (geodetic) origin.
@kwarg latlonh0: Either a C{LatLon}, an L{Ecef9Tuple} or C{scalar} latitude of the origin (C{degrees}). @kwarg lon0: Optional C{scalar} longitude of the origin for C{scalar} B{C{latlonh0}} (C{degrees}). @kwarg height0: Optional origin height (C{meter}), vertically above (or below) the surface of the ellipsoid. @kwarg name: Optional, new name (C{str}).
@raise LocalError: If B{C{latlonh0}} not C{LatLon}, L{Ecef9Tuple}, C{scalar} or invalid or if B{C{lon0}} not C{scalar} for C{scalar} B{C{latlonh0}} or invalid or if B{C{height0}} invalid. '''
suffix=_0_, Error=LocalError, name=name) else:
'''Convert I{local} C{(x, y, z)} to I{geodetic} C{(lat, lon, height)}.
@arg xyz: A I{local} (L{XyzLocal}, L{Enu}, L{Ned}, L{Aer}, L{Local9Tuple}) or local C{x} coordinate (C{scalar}). @kwarg y: Local C{y} coordinate for C{scalar} B{C{xyz}} and B{C{z}} (C{meter}). @kwarg z: Local C{z} coordinate for C{scalar} B{C{xyz}} and B{C{y}} (C{meter}). @kwarg M: Optionally, return the I{concatenated} rotation L{EcefMatrix}, iff available (C{bool}). @kwarg name: Optional name (C{str}).
@return: An L{Local9Tuple}C{(x, y, z, lat, lon, height, ltp, ecef, M)} with I{local} C{x}, C{y}, C{z}, I{geodetic} C{lat}, C{lon}, C{height}, this C{ltp}, an C{ecef} (L{Ecef9Tuple}) with the I{geocentric} C{x}, C{y}, C{z} (and I{geodetic} C{lat}, C{lon}, C{height}) and the I{concatenated} rotation matrix C{M} (L{EcefMatrix}) if requested.
@raise LocalError: Invalid B{C{xyz}} or C{scalar} C{x} or B{C{y}} and/or B{C{z}} not C{scalar} for C{scalar} B{C{xyz}}. '''
'''Return this L{LocalCartesian} as a string.
@kwarg prec: Precision, number of (decimal) digits (0..9).
@return: This L{LocalCartesian} representation (C{str}). '''
'''(INTERNAL) Get C{(x0, y0, z0)} as L{Vector3Tuple}. '''
'''A I{local tangent plan} LTP, a sub-class of C{LocalCartesian} with configurable ECEF converter and without optional rotation matrix. ''' '''New C{Ltp}.
@kwarg latlonh0: The (geodetic) origin (C{LatLon}, L{LatLon4Tuple}, L{Ltp} or L{Ecef9Tuple}) or latitude of the (goedetic) origin (C{degrees}). @kwarg lon0: Optional longitude of the (goedetic) origin for C{scalar} B{C{latlonh0}} and B{C{height0}} (C{degrees}). @kwarg height0: Optional origin height (C{meter}), vertically above (or below) the surface of the ellipsoid. @kwarg ecef: Optional ECEF converter (L{EcefKarney}, L{EcefFarrell21}, L{EcefFarrell22}, L{EcefSudano}, L{EcefVeness} or L{EcefYou} I{instance}), overriding the default L{EcefKarney}C{(datum=Datums.WGS84)}. @kwarg name: Optional name (C{str}).
@return: New instance (C{Ltp}).
@raise LocalError: If B{C{latlonh0}} not C{LatLon}, L{LatLon4Tuple}, L{Ltp} or L{Ecef9Tuple} or B{C{latlonh0}}, B{C{lon0}} or B{C{height0}} invalid, non-C{scalar}.
@raise TypeError: Invalid B{C{ecef}}.
@note: If BC{latlonh0} is an L{Ltp}, only the lat-, longitude and height are duplicated, I{not} the ECEF converter. '''
'''Get this LTP's ECEF converter (C{Ecef...} I{instance}). '''
'''Set this LTP's ECEF converter (C{Ecef...} I{instance}).
@raise TypeError: Invalid B{C{ecef}}. ''' if ecef != self._ecef: # PYCHOK no cover self.reset(self._t0) self._ecef = ecef
'''(INTERNAL) Base class for C{ChLV*} classes. ''' # _92_falsing = ChLVYX2Tuple(2.0e6, 1.0e6) # _95_ - _03_
'''(INTERNAL) Helper for C{ChLVa/e.forward} and C{.reverse}. ''' if bool(M): # PYCHOK no cover m = self.forward if fw else self.reverse # PYCHOK attr n = _DOT_(self.__class__.__name__, m.__name__) raise _NotImplementedError(unstr(n, M=M), txt=None)
'''(INTERNAL) Get C{ChLV*.reverse} args[1:4] names, I{once}. ''' # assert _xargs_names( ChLV.reverse)[1:4] == t # assert _xargs_names(ChLVa.reverse)[1:4] == t # assert _xargs_names(ChLVe.reverse)[1:4] == t
'''Convert WGS84 geodetic to I{Swiss} projection coordinates.
@arg latlonh: Either a C{LatLon}, L{Ltp} or C{scalar} (geodetic) latitude (C{degrees}). @kwarg lon: Optional, C{scalar} (geodetic) longitude for C{scalar} B{C{latlonh}} (C{degrees}). @kwarg height: Optional, height, vertically above (or below) the surface of the ellipsoid (C{meter}) for C{scalar} B{C{latlonh}} and B{C{lon}}. @kwarg M: If C{True}, return the I{concatenated} rotation L{EcefMatrix} iff available for C{ChLV} only, C{None} otherwise (C{bool}). @kwarg name: Optional name (C{str}).
@return: A L{ChLV9Tuple}C{(Y, X, h_, lat, lon, height, ltp, ecef, M)} with the unfalsed I{Swiss Y, X} coordinates, I{Swiss h_} height, the given I{geodetic} C{lat}, C{lon} and C{height}, this C{ChLV*} instance and C{ecef} (L{Ecef9Tuple}) at I{Bern, Ch} and rotation matrix C{M}. The returned C{ltp} is this C{ChLV}, C{ChLVa} or C{ChLVe} instance.
@raise LocalError: Invalid or non-C{scalar} B{C{latlonh}}, B{C{lon}} or B{C{height}}. ''' notOverloaded(self, latlonh, lon=lon, height=height, M=M, name=name)
'''Convert I{Swiss} projection to WGS84 geodetic coordinates.
@arg enh_: A Swiss projection (L{ChLV9Tuple}) or the C{scalar}, falsed I{Swiss E_LV95} or I{y_LV03} easting (C{meter}). @kwarg n: Falsed I{Swiss N_LV85} or I{x_LV03} northing for C{scalar} B{C{enh_}} and B{C{h_}} (C{meter}). @kwarg h_: I{Swiss h'} height for C{scalar} B{C{enh_}} and B{C{n}} (C{meter}). @kwarg M: If C{True}, return the I{concatenated} rotation L{EcefMatrix} iff available for C{ChLV} only, C{None} otherwise (C{bool}). @kwarg name: Optional name (C{str}).
@return: A L{ChLV9Tuple}C{(Y, X, h_, lat, lon, height, ltp, ecef, M)} with the unfalsed I{Swiss Y, X} coordinates, I{Swiss h_} height, the given I{geodetic} C{lat}, C{lon} and C{height}, this C{ChLV*} instance and C{ecef} (L{Ecef9Tuple}) at I{Bern, Ch} and rotation matrix C{M}. The returned C{ltp} is this C{ChLV}, C{ChLVa} or C{ChLVe} instance.
@raise LocalError: Invalid or non-C{scalar} B{C{enh_}}, B{C{n}} or B{C{h_}}. ''' notOverloaded(self, enh_, n=n, h_=h_, M=M, name=name)
'''(INTERNAL) Get the C{LV95} or C{LV03} falsing. ''' _ChLV._03_falsing if LV95 in (False, 3) else ChLVYX2Tuple(0, 0))
'''(INTERNAL) Helper for C{ChLVa/e.forward}. ''' # convert degrees to arc-seconds
'''(INTERNAL) Helper for C{ChLVa/e.reverse}. '''
'''(INTERNAL) Helper for C{ChLV*.reverse}. ''' _xyz_y_z_names=self._enh_n_h) else: # isscalar(enh_)
'''Conversion between I{WGS84 geodetic} and I{Swiss} projection coordinates using L{pygeodesy.EcefKarney}'s Earth-Centered, Earth-Fixed (ECEF) methods.
@see: U{Swiss projection formulas<https://www.SwissTopo.admin.CH/en/maps-data-online/ calculation-services.html>}, page 7ff, U{NAVREF<https://www.SwissTopo.admin.CH/en/ maps-data-online/calculation-services/navref.html>}, U{REFRAME<https://www.SwissTopo.admin.CH/ en/maps-data-online/calculation-services/reframe.html>} and U{SwissTopo Scripts GPS WGS84 <-> LV03<https://GitHub.com/ValentinMinder/Swisstopo-WGS84-LV03>}. '''
# lat, lon, height == 46°57'08.66", 7°26'22.50", 49.55m ("new" 46°57'07.89", 7°26'22.335")
'''New ECEF-based I{WGS84-Swiss} L{ChLV} converter, centered at I{Bern, Ch}.
@kwarg latlonh0: The I{geodetic} origin and height, overriding C{Bern, Ch}. @kwarg other_Ltp_kwds: Optional, other L{Ltp.__init__} keyword arguments.
@see: L{Ltp.__init__} for more information. '''
# overloaded for the _ChLV.forward.__doc__
# overloaded for the _ChLV.reverse.__doc__
'''Add the I{Swiss LV95} or I{LV03} falsing.
@arg Y: Unfalsed I{Swiss Y} easting (C{meter}). @arg X: Unfalsed I{Swiss X} northing (C{meter}). @kwarg LV95: If C{True} add C{LV95} falsing, if C{False} add C{LV03} falsing, otherwise leave unfalsed. @kwarg name: Optional name (C{str}).
@return: A L{ChLVEN2Tuple}C{(E_LV95, N_LV95)} or a L{ChLVyx2Tuple}C{(y_LV03, x_LV03)} with falsed B{C{Y}} and B{C{X}}, otherwise a L{ChLVYX2Tuple}C{(Y, X)} with B{C{Y}} and B{C{X}} as-is. '''
'''Is C{(B{e}, B{n})} a valid I{Swiss LV03} projection?
@arg e: Falsed (or unfalsed) I{Swiss} easting (C{meter}). @arg n: Falsed (or unfalsed) I{Swiss} northing (C{meter}).
@return: C{True} if C{(B{e}, B{n})} is a valid, falsed I{Swiss LV03}, projection C{False} otherwise. ''' # @see: U{Map<https://www.SwissTopo.admin.CH/en/knowledge-facts/ # surveying-geodesy/reference-frames/local/lv95.html>}
'''Is C{(B{e}, B{n})} a valid I{Swiss LV95} or I{LV03} projection?
@arg e: Falsed (or unfalsed) I{Swiss} easting (C{meter}). @arg n: Falsed (or unfalsed) I{Swiss} northing (C{meter}). @kwarg raiser: If C{True}, throw a L{LocalError} if B{C{e}} and B{C{n}} are invalid I{Swiss LV95} nor I{LV03}.
@return: C{True} or C{False} if C{(B{e}, B{n})} is a valid I{Swiss LV95} respectively I{LV03} projection, C{None} otherwise. ''' elif raiser: # PYCHOK no cover raise LocalError(unstr(ChLV.isLV95, e=e, n=n)) return None
'''Remove the I{Swiss LV95} or I{LV03} falsing.
@arg e: Falsed I{Swiss E_LV95} or I{y_LV03} easting (C{meter}). @arg n: Falsed I{Swiss N_LV95} or I{x_LV03} northing (C{meter}). @kwarg LV95: If C{True} remove I{LV95} falsing, if C{False} remove I{LV03} falsing, otherwise use method C{isLV95(B{e}, B{n})}. @kwarg name: Optional name (C{str}).
@return: A L{ChLVYX2Tuple}C{(Y, X)} with the unfalsed B{C{e}} respectively B{C{n}}. '''
'''Conversion between I{WGS84 geodetic} and I{Swiss} projection coordinates using the U{Approximate<https://www.SwissTopo.admin.CH/en/maps-data-online/ calculation-services.html>} formulas, page 13.
@see: Older U{references<https://GitHub.com/alphasldiallo/Swisstopo-WGS84-LV03>}. ''' '''New I{Approximate WGS84-Swiss} L{ChLVa} converter, centered at I{Bern, Ch}.
@kwarg name: Optional name (C{str}), overriding C{Bern.name}. '''
# overloaded for the _ChLV.forward.__doc__
-10938.51 * b * a, -0.36 * b * a2, -44.54 * b * b2) # + 600_000 3745.25 * b2, 76.63 * a2, -194.56 * b2 * a, 119.79 * a2 * a) # + 200_000
# overloaded for the _ChLV.reverse.__doc__
0.791484 * a * b, 0.1306 * a * b2, -0.0436 * a * a2).fover(ChLV._ab_d) -0.270978 * a2, -0.002528 * b2, -0.0447 * a2 * b, -0.014 * b2 * b).fover(ChLV._ab_d)
'''Conversion between I{WGS84 geodetic} and I{Swiss} projection coordinates using the U{Ellipsoidal approximate<https://www.SwissTopo.admin.CH/en/ maps-data-online/calculation-services.html>} formulas, pp 10-11 and U{Bolliger, J.<https://eMuseum.GGGS.CH/literatur-lv/liste-Dateien/1967_Bolliger_a.pdf>} pp 148-151 (also U{GGGS<https://eMuseum.GGGS.CH/literatur-lv/liste.htm>}).
@note: Methods L{ChLVe.forward} and L{ChLVe.reverse} have an additional keyword argument C{B{gamma}=False} to approximate the I{meridian convergence}. If C{B{gamma}=True} a 2-tuple C{(t, gamma)} is returned with C{t} the usual result (C{ChLV9Tuple}) and C{gamma}, the I{meridian convergence} (decimal C{degrees}). To convert C{gamma} to C{grades} or C{gons}, use function L{pygeodesy.degrees2grades}.
@see: Older U{references<https://GitHub.com/alphasldiallo/Swisstopo-WGS84-LV03>}. ''' '''New I{Approximate WGS84-Swiss} L{ChLVe} converter, centered at I{Bern, Ch}.
@kwarg name: Optional name (C{str}), overriding C{Bern.name}. '''
# overloaded for the _ChLV.forward.__doc__
U1 = F(a, 2255515.207166, 2642.456961, 1.284180, 2.577486, 0.001165) U3 = F(a, -412.991934, 64.106344, -2.679566, 0.123833) U5 = F(a, 0.204129, -0.037725) t = t, F(b, 0, U1, 0, U3, 0, U5).fover(ChLV._ab_m) # * ChLV._ab_d degrees?
# overloaded for the _ChLV.reverse.__doc__
# == (ChLV._sLon + a * (A1 + a**2 * (A3 + a**2 * A5))) / ChLV._s_d
'''Convert an attitude oriention into a (3-D) direction vector.
@kwarg tilt: Pitch, elevation from horizontal (C{degrees}), negative down (clockwise rotation along and around the x-axis). @kwarg yaw: Bearing, heading (compass C{degrees360}), clockwise from North (counter-clockwise rotation along and around the z-axis). @kwarg roll: Roll, bank (C{degrees}), positive to the right and down (clockwise rotation along and around the y-axis).
@return: A named B{C{Vector}} instance or if B{C{Vector}} is C{None}, a named L{Vector3Tuple}C{(x, y, z)}.
@see: U{Yaw, pitch, and roll rotations<http://MSL.CS.UIUC.edu/planning/node102.html>} and function L{pygeodesy.hartzell} argument C{los}. ''' Vector3Tuple(d.x, d.y, d.z, name=d.name) if Vector is None else Vector(d.x, d.y, d.z, **_xkwds(Vector_kwds, name=d.name))) # PYCHOK indent
'''(INTERNAL) Validate B{C{ltp}}. ''' ltp = dflt[0] raise _TypesError(_ltp_, ltp, Ltp, LocalCartesian)
# **) MIT License # # Copyright (C) 2016-2023 -- mrJean1 at Gmail -- All Rights Reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, merge, publish, distribute, sublicense, # and/or sell copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. |