pygeodesy 24.5.24__py2.py3-none-any.whl → 24.6.1__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {PyGeodesy-24.5.24.dist-info → PyGeodesy-24.6.1.dist-info}/METADATA +6 -5
- {PyGeodesy-24.5.24.dist-info → PyGeodesy-24.6.1.dist-info}/RECORD +57 -57
- pygeodesy/__init__.py +4 -4
- pygeodesy/auxilats/__init__.py +1 -1
- pygeodesy/auxilats/__main__.py +2 -2
- pygeodesy/auxilats/auxAngle.py +4 -4
- pygeodesy/basics.py +39 -5
- pygeodesy/booleans.py +3 -3
- pygeodesy/constants.py +3 -3
- pygeodesy/deprecated/functions.py +9 -3
- pygeodesy/ecef.py +22 -21
- pygeodesy/ellipsoidalBase.py +15 -16
- pygeodesy/ellipsoidalGeodSolve.py +2 -2
- pygeodesy/ellipsoidalKarney.py +3 -3
- pygeodesy/ellipsoids.py +6 -5
- pygeodesy/errors.py +19 -9
- pygeodesy/etm.py +16 -21
- pygeodesy/fmath.py +9 -20
- pygeodesy/formy.py +60 -74
- pygeodesy/frechet.py +11 -11
- pygeodesy/fsums.py +59 -25
- pygeodesy/geodesicx/__init__.py +1 -1
- pygeodesy/geodesicx/__main__.py +2 -2
- pygeodesy/geodesicx/gx.py +3 -5
- pygeodesy/geodsolve.py +2 -2
- pygeodesy/geohash.py +14 -14
- pygeodesy/hausdorff.py +12 -12
- pygeodesy/heights.py +5 -5
- pygeodesy/internals.py +3 -3
- pygeodesy/karney.py +8 -7
- pygeodesy/lazily.py +2 -2
- pygeodesy/ltp.py +62 -44
- pygeodesy/ltpTuples.py +202 -147
- pygeodesy/mgrs.py +24 -24
- pygeodesy/named.py +68 -70
- pygeodesy/nvectorBase.py +2 -2
- pygeodesy/osgr.py +40 -48
- pygeodesy/points.py +10 -10
- pygeodesy/props.py +29 -16
- pygeodesy/rhumb/aux_.py +13 -15
- pygeodesy/rhumb/bases.py +12 -5
- pygeodesy/rhumb/ekx.py +24 -18
- pygeodesy/rhumb/solve.py +13 -10
- pygeodesy/simplify.py +16 -16
- pygeodesy/solveBase.py +14 -14
- pygeodesy/sphericalBase.py +17 -21
- pygeodesy/sphericalTrigonometry.py +17 -17
- pygeodesy/trf.py +9 -7
- pygeodesy/triaxials.py +2 -2
- pygeodesy/ups.py +66 -70
- pygeodesy/utily.py +3 -3
- pygeodesy/utm.py +152 -156
- pygeodesy/utmups.py +38 -38
- pygeodesy/utmupsBase.py +102 -106
- pygeodesy/webmercator.py +43 -51
- {PyGeodesy-24.5.24.dist-info → PyGeodesy-24.6.1.dist-info}/WHEEL +0 -0
- {PyGeodesy-24.5.24.dist-info → PyGeodesy-24.6.1.dist-info}/top_level.txt +0 -0
pygeodesy/ellipsoidalBase.py
CHANGED
|
@@ -37,7 +37,7 @@ from pygeodesy.units import Epoch, _isDegrees, Radius_, _1mm as _TOL_M
|
|
|
37
37
|
# from math import fabs # from .latlonBase
|
|
38
38
|
|
|
39
39
|
__all__ = _ALL_LAZY.ellipsoidalBase
|
|
40
|
-
__version__ = '24.05.
|
|
40
|
+
__version__ = '24.05.31'
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
class CartesianEllipsoidalBase(CartesianBase):
|
|
@@ -741,21 +741,19 @@ class LatLonEllipsoidalBase(LatLonBase):
|
|
|
741
741
|
'''Parse a string consisting of C{"lat, lon[, height]"},
|
|
742
742
|
representing a similar, ellipsoidal C{LatLon} point.
|
|
743
743
|
|
|
744
|
-
@arg strllh: Lat, lon and optional height (C{str}),
|
|
745
|
-
|
|
746
|
-
@kwarg height: Optional, default height (C{meter} or
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
this reframe I{without conversion}.
|
|
744
|
+
@arg strllh: Lat, lon and optional height (C{str}), see function
|
|
745
|
+
L{pygeodesy.parse3llh}.
|
|
746
|
+
@kwarg height: Optional, default height (C{meter} or C{None}).
|
|
747
|
+
@kwarg datum: Optional datum (L{Datum}), overriding this datum
|
|
748
|
+
I{without conversion}.
|
|
749
|
+
@kwarg epoch: Optional datum (L{Epoch}), overriding this epoch
|
|
750
|
+
I{without conversion}.
|
|
751
|
+
@kwarg reframe: Optional datum (L{RefFrame}), overriding this
|
|
752
|
+
reframe I{without conversion}.
|
|
754
753
|
@kwarg sep: Optional separator (C{str}).
|
|
755
|
-
@kwarg wrap: If C{True}, wrap or I{normalize} the lat-
|
|
756
|
-
|
|
757
|
-
@kwarg name: Optional C{B{name}=NN} (C{str}), overriding
|
|
758
|
-
this name.
|
|
754
|
+
@kwarg wrap: If C{True}, wrap or I{normalize} the lat- and
|
|
755
|
+
longitude (C{bool}).
|
|
756
|
+
@kwarg name: Optional C{B{name}=NN} (C{str}), overriding this name.
|
|
759
757
|
|
|
760
758
|
@return: The similar point (ellipsoidal C{LatLon}).
|
|
761
759
|
|
|
@@ -914,7 +912,8 @@ class LatLonEllipsoidalBase(LatLonBase):
|
|
|
914
912
|
@see: Function L{pygeodesy.toOsgr}.
|
|
915
913
|
'''
|
|
916
914
|
if toOsgr_kwds:
|
|
917
|
-
|
|
915
|
+
kwds = _name1__(toOsgr_kwds, _or_nameof=self)
|
|
916
|
+
r = _MODS.osgr.toOsgr(self, kTM=kTM, **kwds)
|
|
918
917
|
else:
|
|
919
918
|
r = self._osgrTM if kTM else self._osgr
|
|
920
919
|
return r
|
|
@@ -24,7 +24,7 @@ from pygeodesy.points import _areaError, ispolar # PYCHOK exported
|
|
|
24
24
|
# from math import fabs # from .karney
|
|
25
25
|
|
|
26
26
|
__all__ = _ALL_LAZY.ellipsoidalGeodSolve
|
|
27
|
-
__version__ = '24.
|
|
27
|
+
__version__ = '24.05.25'
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
class Cartesian(CartesianEllipsoidalBase):
|
|
@@ -76,7 +76,7 @@ class LatLon(LatLonEllipsoidalBaseDI):
|
|
|
76
76
|
@kwarg Cartesian_datum_kwds: Optional L{Cartesian}, B{C{datum}}
|
|
77
77
|
and other keyword arguments, ignored if C{B{Cartesian} is None}.
|
|
78
78
|
Use C{B{Cartesian}=...} to override this L{Cartesian} class
|
|
79
|
-
or set C{B{Cartesian}
|
|
79
|
+
or set C{B{Cartesian}=None}.
|
|
80
80
|
|
|
81
81
|
@return: The cartesian (ECEF) coordinates (L{Cartesian}) or if
|
|
82
82
|
B{C{Cartesian}} is C{None}, an L{Ecef9Tuple}C{(x, y, z,
|
pygeodesy/ellipsoidalKarney.py
CHANGED
|
@@ -43,7 +43,7 @@ from pygeodesy.props import deprecated_method, Property_RO
|
|
|
43
43
|
# from math import fabs # from .karney
|
|
44
44
|
|
|
45
45
|
__all__ = _ALL_LAZY.ellipsoidalKarney
|
|
46
|
-
__version__ = '24.
|
|
46
|
+
__version__ = '24.05.25'
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
class Cartesian(CartesianEllipsoidalBase):
|
|
@@ -105,8 +105,8 @@ class LatLon(LatLonEllipsoidalBaseDI):
|
|
|
105
105
|
|
|
106
106
|
@kwarg Cartesian_datum_kwds: Optional L{Cartesian}, B{C{datum}}
|
|
107
107
|
and other keyword arguments, ignored if C{B{Cartesian} is None}.
|
|
108
|
-
Use C{B{Cartesian}=...} to override this L{Cartesian} class
|
|
109
|
-
|
|
108
|
+
Use C{B{Cartesian}=...} to override this L{Cartesian} class or
|
|
109
|
+
set C{B{Cartesian}=None}.
|
|
110
110
|
|
|
111
111
|
@return: The cartesian (ECEF) coordinates (L{Cartesian}) or if
|
|
112
112
|
B{C{Cartesian}} is C{None}, an L{Ecef9Tuple}C{(x, y, z,
|
pygeodesy/ellipsoids.py
CHANGED
|
@@ -80,11 +80,12 @@ from pygeodesy.interns import NN, _a_, _Airy1830_, _AiryModified_, _b_, _Bessel1
|
|
|
80
80
|
_prime_vertical_, _radius_, _Sphere_, _SPACE_, _vs_, _WGS72_, _WGS84_
|
|
81
81
|
# from pygeodesy.lazily import _ALL_LAZY, _ALL_MODS as _MODS # from .named
|
|
82
82
|
from pygeodesy.named import _lazyNamedEnumItem as _lazy, _name__, _name2__, _NamedEnum, \
|
|
83
|
-
_NamedEnumItem, _NamedTuple, _Pass, _ALL_LAZY,
|
|
83
|
+
_NamedEnumItem, _NamedTuple, _Pass, _ALL_LAZY, _MODS
|
|
84
84
|
from pygeodesy.namedTuples import Distance2Tuple, Vector3Tuple, Vector4Tuple
|
|
85
85
|
from pygeodesy.props import deprecated_Property_RO, Property_RO, property_doc_, \
|
|
86
86
|
deprecated_property_RO, property_RO
|
|
87
87
|
from pygeodesy.streprs import Fmt, fstr, instr, strs, unstr
|
|
88
|
+
# from pygeodesy.triaxials import _hartzell3 # _MODS
|
|
88
89
|
from pygeodesy.units import Bearing_, Distance, Float, Float_, Height, Lam_, Lat, Meter, \
|
|
89
90
|
Meter2, Meter3, Phi, Phi_, Radius, Radius_, Scalar
|
|
90
91
|
from pygeodesy.utily import atan1, atan1d, atan2b, degrees90, m2radians, radians2m, sincos2d
|
|
@@ -92,7 +93,7 @@ from pygeodesy.utily import atan1, atan1d, atan2b, degrees90, m2radians, radians
|
|
|
92
93
|
from math import asinh, atan, atanh, cos, degrees, exp, fabs, radians, sin, sinh, sqrt, tan
|
|
93
94
|
|
|
94
95
|
__all__ = _ALL_LAZY.ellipsoids
|
|
95
|
-
__version__ = '24.05.
|
|
96
|
+
__version__ = '24.05.28'
|
|
96
97
|
|
|
97
98
|
_f_0_0 = Float(f =_0_0) # zero flattening
|
|
98
99
|
_f__0_0 = Float(f_=_0_0) # zero inverse flattening
|
|
@@ -1101,7 +1102,7 @@ class Ellipsoid(_NamedEnumItem):
|
|
|
1101
1102
|
methods L{Ellipsoid.height4} and L{Triaxial.hartzell4}.
|
|
1102
1103
|
'''
|
|
1103
1104
|
try:
|
|
1104
|
-
v, d = _MODS.triaxials.
|
|
1105
|
+
v, d, _ = _MODS.triaxials._hartzell3(pov, los, self._triaxial)
|
|
1105
1106
|
except Exception as x:
|
|
1106
1107
|
raise IntersectionError(pov=pov, los=los, cause=x)
|
|
1107
1108
|
return Vector4Tuple(v.x, v.y, v.z, d, name__=self.hartzell4)
|
|
@@ -1643,9 +1644,9 @@ class Ellipsoid(_NamedEnumItem):
|
|
|
1643
1644
|
r = self.e2s2(sin(a))
|
|
1644
1645
|
if r > EPS02:
|
|
1645
1646
|
n = self.a / sqrt(r)
|
|
1646
|
-
m = n * self.e21 / r
|
|
1647
|
+
m = n * self.e21 / r
|
|
1647
1648
|
else:
|
|
1648
|
-
m = n = _0_0
|
|
1649
|
+
m = n = _0_0
|
|
1649
1650
|
else:
|
|
1650
1651
|
m = n = self.a
|
|
1651
1652
|
if scaled and a:
|
pygeodesy/errors.py
CHANGED
|
@@ -26,7 +26,7 @@ from pygeodesy.lazily import _ALL_LAZY, _ALL_MODS as _MODS, _getenv, _PYTHON_X_D
|
|
|
26
26
|
from copy import copy as _copy
|
|
27
27
|
|
|
28
28
|
__all__ = _ALL_LAZY.errors # _ALL_DOCS('_InvalidError', '_IsnotError') _under
|
|
29
|
-
__version__ = '24.05.
|
|
29
|
+
__version__ = '24.05.29'
|
|
30
30
|
|
|
31
31
|
_argument_ = 'argument'
|
|
32
32
|
_box_ = 'box'
|
|
@@ -252,7 +252,7 @@ class LenError(_ValueError): # in .ecef, .fmath, .heights, .iters, .named
|
|
|
252
252
|
class LimitError(_ValueError):
|
|
253
253
|
'''Error raised for lat- or longitudinal values or deltas exceeding
|
|
254
254
|
the given B{C{limit}} in functions L{pygeodesy.equirectangular},
|
|
255
|
-
L{pygeodesy.
|
|
255
|
+
L{pygeodesy.equirectangular4}, C{nearestOn*} and C{simplify*}
|
|
256
256
|
or methods with C{limit} or C{options} keyword arguments.
|
|
257
257
|
|
|
258
258
|
@see: Subclass L{UnitError}.
|
|
@@ -748,8 +748,8 @@ def _xkwds_get(kwds, **name_default):
|
|
|
748
748
|
C{default} if not present.
|
|
749
749
|
'''
|
|
750
750
|
if isinstance(kwds, dict) and len(name_default) == 1:
|
|
751
|
-
for n,
|
|
752
|
-
return kwds.get(n,
|
|
751
|
+
for n, v in name_default.items():
|
|
752
|
+
return kwds.get(n, v)
|
|
753
753
|
raise _xAssertionError(_xkwds_get, kwds, **name_default)
|
|
754
754
|
|
|
755
755
|
|
|
@@ -759,8 +759,18 @@ def _xkwds_get_(kwds, **names_defaults):
|
|
|
759
759
|
'''
|
|
760
760
|
if not isinstance(kwds, dict):
|
|
761
761
|
raise _xAssertionError(_xkwds_get_, kwds)
|
|
762
|
-
for n,
|
|
763
|
-
yield kwds.get(n,
|
|
762
|
+
for n, v in _MODS.basics.itemsorted(names_defaults):
|
|
763
|
+
yield kwds.get(n, v)
|
|
764
|
+
|
|
765
|
+
|
|
766
|
+
def _xkwds_get1(kwds, **name_default):
|
|
767
|
+
'''(INTERNAL) Get one C{kwds} value by C{name} or the
|
|
768
|
+
C{default} if not present.
|
|
769
|
+
'''
|
|
770
|
+
v, kwds = _xkwds_pop2(kwds, **name_default)
|
|
771
|
+
if kwds:
|
|
772
|
+
raise _UnexpectedError(**kwds)
|
|
773
|
+
return v
|
|
764
774
|
|
|
765
775
|
|
|
766
776
|
def _xkwds_item2(kwds):
|
|
@@ -784,11 +794,11 @@ def _xkwds_pop2(kwds, **name_default):
|
|
|
784
794
|
reduced C{kwds} copy, otherwise the C{default} and original C{kwds}.
|
|
785
795
|
'''
|
|
786
796
|
if isinstance(kwds, dict) and len(name_default) == 1:
|
|
787
|
-
for n,
|
|
797
|
+
for n, v in name_default.items():
|
|
788
798
|
if n in kwds:
|
|
789
799
|
kwds = _copy(kwds)
|
|
790
|
-
|
|
791
|
-
return
|
|
800
|
+
v = kwds.pop(n, v)
|
|
801
|
+
return v, kwds
|
|
792
802
|
raise _xAssertionError(_xkwds_pop2, kwds, **name_default)
|
|
793
803
|
|
|
794
804
|
|
pygeodesy/etm.py
CHANGED
|
@@ -92,7 +92,7 @@ from pygeodesy.utm import _cmlon, _LLEB, _parseUTM5, _toBand, _toXtm8, \
|
|
|
92
92
|
from math import asinh, atan2, degrees, radians, sinh, sqrt
|
|
93
93
|
|
|
94
94
|
__all__ = _ALL_LAZY.etm
|
|
95
|
-
__version__ = '24.05.
|
|
95
|
+
__version__ = '24.05.31'
|
|
96
96
|
|
|
97
97
|
_OVERFLOW = _1_EPS**2 # about 2e+31
|
|
98
98
|
_TAYTOL = pow(EPS, 0.6)
|
|
@@ -101,12 +101,6 @@ _TOL_10 = EPS * _0_1
|
|
|
101
101
|
_TRIPS = 21 # C++ 10
|
|
102
102
|
|
|
103
103
|
|
|
104
|
-
def _overflow(x):
|
|
105
|
-
'''(INTERNAL) Like C{copysign0(OVERFLOW, B{x})}.
|
|
106
|
-
'''
|
|
107
|
-
return _copyBit(_OVERFLOW, x)
|
|
108
|
-
|
|
109
|
-
|
|
110
104
|
class ETMError(UTMError):
|
|
111
105
|
'''Exact Transverse Mercator (ETM) parse, projection or other
|
|
112
106
|
L{Etm} issue or L{ExactTransverseMercator} conversion failure.
|
|
@@ -160,17 +154,15 @@ class Etm(Utm):
|
|
|
160
154
|
def parse(self, strETM, **name):
|
|
161
155
|
'''Parse a string to a similar L{Etm} instance.
|
|
162
156
|
|
|
163
|
-
@arg strETM: The ETM coordinate (C{str}), see function
|
|
164
|
-
|
|
165
|
-
@kwarg name: Optional C{B{name}=NN} (C{str}), overriding
|
|
166
|
-
this name.
|
|
157
|
+
@arg strETM: The ETM coordinate (C{str}), see function L{parseETM5}.
|
|
158
|
+
@kwarg name: Optional C{B{name}=NN} (C{str}), overriding this name.
|
|
167
159
|
|
|
168
160
|
@return: The instance (L{Etm}).
|
|
169
161
|
|
|
170
162
|
@raise ETMError: Invalid B{C{strETM}}.
|
|
171
163
|
|
|
172
|
-
@see: Function L{pygeodesy.parseUPS5}, L{pygeodesy.parseUTM5}
|
|
173
|
-
|
|
164
|
+
@see: Function L{pygeodesy.parseUPS5}, L{pygeodesy.parseUTM5} and
|
|
165
|
+
L{pygeodesy.parseUTMUPS5}.
|
|
174
166
|
'''
|
|
175
167
|
return parseETM5(strETM, datum=self.datum, Etm=self.classof,
|
|
176
168
|
name=self._name__(name))
|
|
@@ -217,9 +209,7 @@ class Etm(Utm):
|
|
|
217
209
|
lat, lon, g, k = xTM.reverse(e, n, lon0=lon0)
|
|
218
210
|
|
|
219
211
|
ll = _LLEB(lat, lon, datum=d, name=self.name) # utm._LLEB
|
|
220
|
-
ll
|
|
221
|
-
ll._scale = k
|
|
222
|
-
self._latlon5args(ll, _toBand, unfalse, xTM)
|
|
212
|
+
self._latlon5args(ll, g, k, _toBand, unfalse, xTM)
|
|
223
213
|
|
|
224
214
|
def toUtm(self): # PYCHOK signature
|
|
225
215
|
'''Copy this ETM to a UTM coordinate.
|
|
@@ -1032,6 +1022,12 @@ class ExactTransverseMercator(_NamedBase):
|
|
|
1032
1022
|
return g_k # or (g, k, lat, lon)
|
|
1033
1023
|
|
|
1034
1024
|
|
|
1025
|
+
def _overflow(x):
|
|
1026
|
+
'''(INTERNAL) Like C{copysign0(OVERFLOW, B{x})}.
|
|
1027
|
+
'''
|
|
1028
|
+
return _copyBit(_OVERFLOW, x)
|
|
1029
|
+
|
|
1030
|
+
|
|
1035
1031
|
def parseETM5(strUTM, datum=_WGS84, Etm=Etm, falsed=True, **name):
|
|
1036
1032
|
'''Parse a string representing a UTM coordinate, consisting
|
|
1037
1033
|
of C{"zone[band] hemisphere easting northing"}.
|
|
@@ -1058,8 +1054,7 @@ def parseETM5(strUTM, datum=_WGS84, Etm=Etm, falsed=True, **name):
|
|
|
1058
1054
|
|
|
1059
1055
|
|
|
1060
1056
|
def toEtm8(latlon, lon=None, datum=None, Etm=Etm, falsed=True,
|
|
1061
|
-
|
|
1062
|
-
**name_cmoff):
|
|
1057
|
+
strict=True, zone=None, **name_cmoff):
|
|
1063
1058
|
'''Convert a geodetic lat-/longitude to an ETM coordinate.
|
|
1064
1059
|
|
|
1065
1060
|
@arg latlon: Latitude (C{degrees}) or an (ellipsoidal)
|
|
@@ -1075,9 +1070,9 @@ def toEtm8(latlon, lon=None, datum=None, Etm=Etm, falsed=True,
|
|
|
1075
1070
|
@kwarg strict: Restrict B{C{lat}} to UTM ranges (C{bool}).
|
|
1076
1071
|
@kwarg zone: Optional UTM zone to enforce (C{int} or C{str}).
|
|
1077
1072
|
@kwarg name_cmoff: Optional B{C{Etm}} C{B{name}=NN} (C{str})
|
|
1078
|
-
and DEPRECATED C{B{cmoff}=True}
|
|
1079
|
-
from the zone's central
|
|
1080
|
-
|
|
1073
|
+
and DEPRECATED keyword argument C{B{cmoff}=True}
|
|
1074
|
+
to offset the longitude from the zone's central
|
|
1075
|
+
meridian (C{bool}), use B{C{falsed}} instead.
|
|
1081
1076
|
|
|
1082
1077
|
@return: The ETM coordinate as an B{C{Etm}} instance or a
|
|
1083
1078
|
L{UtmUps8Tuple}C{(zone, hemipole, easting, northing,
|
pygeodesy/fmath.py
CHANGED
|
@@ -12,7 +12,7 @@ from pygeodesy.constants import EPS0, EPS02, EPS1, NAN, PI, PI_2, PI_4, \
|
|
|
12
12
|
_0_0, _0_125, _1_6th, _0_25, _1_3rd, _0_5, _1_0, \
|
|
13
13
|
_N_1_0, _1_5, _copysign_0_0, _isfinite, remainder
|
|
14
14
|
from pygeodesy.errors import _IsnotError, LenError, _TypeError, _ValueError, \
|
|
15
|
-
_xError,
|
|
15
|
+
_xError, _xkwds_get1, _xkwds_pop2
|
|
16
16
|
from pygeodesy.fsums import _2float, Fsum, fsum, fsum1_, _isFsumTuple, _1primed, \
|
|
17
17
|
Fmt, unstr
|
|
18
18
|
from pygeodesy.interns import MISSING, _negative_, _not_scalar_
|
|
@@ -24,7 +24,7 @@ from math import fabs, sqrt # pow
|
|
|
24
24
|
import operator as _operator # in .datums, .trf, .utm
|
|
25
25
|
|
|
26
26
|
__all__ = _ALL_LAZY.fmath
|
|
27
|
-
__version__ = '24.05.
|
|
27
|
+
__version__ = '24.05.29'
|
|
28
28
|
|
|
29
29
|
# sqrt(2) <https://WikiPedia.org/wiki/Square_root_of_2>
|
|
30
30
|
_0_4142 = 0.41421356237309504880 # ... sqrt(2) - 1
|
|
@@ -85,19 +85,7 @@ class Fhorner(Fsum):
|
|
|
85
85
|
'''
|
|
86
86
|
Fsum.__init__(self, **name_RESIDUAL)
|
|
87
87
|
if cs:
|
|
88
|
-
|
|
89
|
-
_mul = self._mul_Fsum
|
|
90
|
-
else:
|
|
91
|
-
_mul = self._mul_scalar
|
|
92
|
-
x = _2float(x=x)
|
|
93
|
-
op = Fhorner.__name__
|
|
94
|
-
if len(cs) > 1 and x:
|
|
95
|
-
for c in reversed(cs):
|
|
96
|
-
self._fset_ps(_mul(x, op))
|
|
97
|
-
self._fadd(c, op, up=False)
|
|
98
|
-
self._update()
|
|
99
|
-
else: # x == 0
|
|
100
|
-
self._fadd(cs[0], op)
|
|
88
|
+
self._fhorner(x, cs, Fhorner.__name__)
|
|
101
89
|
else:
|
|
102
90
|
self._fset_ps(_0_0)
|
|
103
91
|
|
|
@@ -343,8 +331,9 @@ def facos1(x):
|
|
|
343
331
|
if a < EPS0:
|
|
344
332
|
r = PI_2
|
|
345
333
|
elif a < EPS1:
|
|
346
|
-
H
|
|
347
|
-
|
|
334
|
+
H = Fhorner(-a, 1.5707288, 0.2121144, 0.0742610, 0.0187293)
|
|
335
|
+
H *= Fsqrt(_1_0, -a)
|
|
336
|
+
r = float(H)
|
|
348
337
|
if x < 0:
|
|
349
338
|
r = PI - r
|
|
350
339
|
else:
|
|
@@ -376,7 +365,7 @@ def fatan(x):
|
|
|
376
365
|
|
|
377
366
|
|
|
378
367
|
def fatan1(x):
|
|
379
|
-
'''Fast approximation of C{atan(B{x})} for C{0 <= B{x}
|
|
368
|
+
'''Fast approximation of C{atan(B{x})} for C{0 <= B{x} < 1}, I{unchecked}.
|
|
380
369
|
|
|
381
370
|
@see: U{ShaderFastLibs.h<https://GitHub.com/michaldrobot/ShaderFastLibs/
|
|
382
371
|
blob/master/ShaderFastMathLib.h>} and U{Efficient approximations
|
|
@@ -385,7 +374,7 @@ def fatan1(x):
|
|
|
385
374
|
IEEE Signal Processing Magazine, 111, May 2006.
|
|
386
375
|
'''
|
|
387
376
|
# Eq (9): PI_4 * x - x * (abs(x) - 1) * (0.2447 + 0.0663 * abs(x)), for -1 < x < 1
|
|
388
|
-
# PI_4 * x - (x**2 - x) * (0.2447 + 0.0663 * x), for 0 < x
|
|
377
|
+
# PI_4 * x - (x**2 - x) * (0.2447 + 0.0663 * x), for 0 < x < 1
|
|
389
378
|
# x * (1.0300981633974482 + x * (-0.1784 - x * 0.0663))
|
|
390
379
|
H = Fhorner(x, _0_0, 1.0300981634, -0.1784, -0.0663)
|
|
391
380
|
return float(H)
|
|
@@ -597,7 +586,7 @@ def fpolynomial(x, *cs, **over):
|
|
|
597
586
|
@see: Class L{Fpolynomial} for further details.
|
|
598
587
|
'''
|
|
599
588
|
P = Fpolynomial(x, *cs)
|
|
600
|
-
d =
|
|
589
|
+
d = _xkwds_get1(over, over=0) if over else 0
|
|
601
590
|
return P.fover(d) if d else float(P)
|
|
602
591
|
|
|
603
592
|
|