pygeodesy 24.3.24__py2.py3-none-any.whl → 24.4.4__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/lazily.py CHANGED
@@ -284,7 +284,7 @@ _ALL_LAZY = _NamedEnum_RO(_name='_ALL_LAZY',
284
284
  'FrechetVincentys', 'Frechet6Tuple',
285
285
  'frechet_'),
286
286
  fstats=_i('Fcook', 'Flinear', 'Fwelford'),
287
- fsums=_i('Fsum', 'Fsum2Tuple', 'ResidualError',
287
+ fsums=_i('Fsum', 'DivMod2Tuple', 'Fsum2Tuple', 'ResidualError',
288
288
  'fsum', 'fsum_', 'fsumf_', 'fsum1', 'fsum1_', 'fsum1f_'),
289
289
  gars=_i('Garef', 'GARSError'),
290
290
  geodesicw=_i('Geodesic', 'GeodesicLine', 'Geodesic_WGS84'),
@@ -504,7 +504,7 @@ class _ALL_MODS(object):
504
504
  _ALL_MODS = _ALL_MODS() # PYCHOK singleton
505
505
 
506
506
  __all__ = _ALL_LAZY.lazily
507
- __version__ = '24.02.22'
507
+ __version__ = '24.03.29'
508
508
 
509
509
 
510
510
  def _ALL_OTHER(*objs):
pygeodesy/resections.py CHANGED
@@ -13,9 +13,10 @@ L{triAngle}, L{triAngle5}, L{triSide}, L{triSide2} and L{triSide4}.
13
13
  from __future__ import division as _; del _ # PYCHOK semicolon
14
14
 
15
15
  from pygeodesy.basics import map1, map2, _zip, _ALL_LAZY
16
- from pygeodesy.constants import EPS, EPS0, EPS02, INT0, NEG0, PI, PI2, PI_2, PI_4, \
17
- _0_0, _0_5, _1_0, _N_1_0, _2_0, _N_2_0, _4_0, _16_0, \
18
- _180_0, _360_0, isnear0, _over, _umod_360
16
+ from pygeodesy.constants import EPS, EPS0, EPS02, INT0, PI, PI2, PI_2, PI_4, \
17
+ _0_0, _0_5, _1_0, _N_1_0, _2_0, _N_2_0, _4_0, \
18
+ _16_0, _180_0, _360_0, _copysign_0_0, isnear0, \
19
+ _over, _umod_360
19
20
  from pygeodesy.errors import _and, _or, TriangleError, _ValueError, _xcallable, \
20
21
  _xkwds, _xkwds_pop2
21
22
  from pygeodesy.fmath import favg, Fdot, fidw, fmean, hypot, hypot2_
@@ -33,7 +34,7 @@ from pygeodesy.vector3d import _otherV3d, Vector3d
33
34
  from math import cos, atan2, degrees, fabs, radians, sin, sqrt
34
35
 
35
36
  __all__ = _ALL_LAZY.resections
36
- __version__ = '24.03.24'
37
+ __version__ = '24.04.04'
37
38
 
38
39
  _concyclic_ = 'concyclic'
39
40
  _PA_ = 'PA'
@@ -457,7 +458,7 @@ def pierlotx(point1, point2, point3, alpha1, alpha2, alpha3, useZ=False,
457
458
 
458
459
  def _cot(s, c): # I{exact} cotangent
459
460
  try:
460
- return (c / s) if c else (NEG0 if s < 0 else _0_0)
461
+ return (c / s) if c else _copysign_0_0(s)
461
462
  except ZeroDivisionError:
462
463
  raise ValueError(_or(_coincident_, _colinear_))
463
464
 
@@ -970,44 +971,43 @@ def wildberger3(a, b, c, alpha, beta, R3=min):
970
971
  def _s(x):
971
972
  return sin(x)**2
972
973
 
973
- def _vpa(r1, r3, q2, q3, s3):
974
- r = r1 * r3 * _4_0
975
- n = (r - _F1(r1, r3, -q2).fpow(2)).fover(s3)
976
- if n < 0 or isnear0(r):
974
+ def _vpa(r3, q2, q3, s2, s3):
975
+ r1 = s2 * q3 / s3
976
+ r = r1 * r3 * _4_0
977
+ n = (r - _F1(r1, r3, -q2)**2).fover(s3)
978
+ if n < 0 or r < EPS0:
977
979
  raise ValueError(_coincident_)
978
980
  return sqrt((n / r) * q3) if n else _0_0
979
981
 
980
982
  try:
981
- a, b, c, da, db = t = map1(float, a, b, c, alpha, beta)
982
- if min(t) < 0:
983
+ a, b, c, da, db = q = map1(float, a, b, c, alpha, beta)
984
+ if min(q) < 0:
983
985
  raise ValueError(_negative_)
984
986
 
985
- ra, rb = radians(da), radians(db)
986
- s1, s2, s3 = s = map1(_s, rb, ra, ra + rb) # rb, ra!
987
- if min(s) < EPS02:
988
- raise ValueError(_or(_coincident_, _colinear_))
989
-
990
987
  q1, q2, q3 = q = a**2, b**2, c**2
991
988
  if min(q) < EPS02:
992
989
  raise ValueError(_coincident_)
993
990
 
994
- r1 = s2 * q3 / s3 # s2!
995
- r2 = s1 * q3 / s3 # s1!
996
- Qs = _F1(*q) # == hypot2_(a, b, c)
997
- Ss = _F1(*s) # == fsum1(s)
998
- s += (Qs * _0_5), # tuple!
999
- C0 = Fdot(s, q1, q2, q3, -Ss)
1000
- r3 = C0.fover(-s3)
1001
- d0 = Qs.fpow(2).fsub_(hypot2_(*q) * _2_0).fmul(s1 * s2).fover(s3)
991
+ ra, rb = map1(radians, da, db)
992
+ s1, s2, s3 = s = map1(_s, rb, ra, ra + rb) # rb, ra!
993
+ if min(s) < EPS02:
994
+ raise ValueError(_or(_coincident_, _colinear_))
995
+
996
+ q4 = hypot2_(*q) * _2_0 # a**4 + ...
997
+ Qs = _F1(*q) # == hypot2_(a, b, c)
998
+ d0 = (Qs**2 - q4).fmul(s1 * s2).fover(s3)
999
+ if d0 < 0:
1000
+ raise ValueError(_negative_)
1001
+ s += _F1(*s), # == fsum1(s),
1002
+ C0 = Fdot(s, q1, q2, q3, -Qs * _0_5)
1003
+ r3 = C0.fover(-s3) # C0 /= -s3
1002
1004
  if d0 > EPS02: # > c0
1003
1005
  _xcallable(R3=R3)
1004
1006
  d0 = sqrt(d0)
1005
1007
  r3 = R3(float(C0 + d0), float(C0 - d0)) # XXX min or max
1006
- elif d0 < 0:
1007
- raise ValueError(_negative_)
1008
1008
 
1009
- pa = _vpa(r1, r3, q2, q3, s3)
1010
- pb = _vpa(r2, r3, q1, q3, s3)
1009
+ pa = _vpa(r3, q2, q3, s2, s3)
1010
+ pb = _vpa(r3, q1, q3, s1, s3)
1011
1011
  pc = favg(_triSide2(b, pa, ra).a,
1012
1012
  _triSide2(a, pb, rb).a)
1013
1013
  return Survey3Tuple(pa, pb, pc, name=wildberger3.__name__)
pygeodesy/utily.py CHANGED
@@ -10,12 +10,14 @@ U{Vector-based geodesy<https://www.Movable-Type.co.UK/scripts/latlong-vectors.ht
10
10
  # make sure int/int division yields float quotient, see .basics
11
11
  from __future__ import division as _; del _ # PYCHOK semicolon
12
12
 
13
- from pygeodesy.basics import _copysign, isinstanceof, isint, isstr, neg, _passargs
14
- from pygeodesy.constants import EPS, EPS0, INF, NAN, NEG0, PI, PI2, PI_2, R_M, \
15
- _float as _F, _isfinite, isnan, isnear0, _over, \
16
- _umod_360, _umod_PI2, _M_KM, _M_NM, _M_SM, _0_0, \
17
- _1__90, _0_5, _1_0, _N_1_0, _2__PI, _10_0, _90_0, \
18
- _N_90_0, _180_0, _N_180_0, _360_0, _400_0
13
+ from pygeodesy.basics import _copysign, isinstanceof, isint, isstr, neg, \
14
+ _passargs
15
+ from pygeodesy.constants import EPS, EPS0, INF, NAN, PI, PI2, PI_2, R_M, \
16
+ _M_KM, _M_NM, _M_SM, _0_0, _1__90, _0_5, _1_0, \
17
+ _N_1_0, _2__PI, _10_0, _90_0, _N_90_0, _180_0, \
18
+ _N_180_0, _360_0, _400_0, _copysign_0_0, \
19
+ _float as _F, _isfinite, isnan, isnear0, \
20
+ _over, _umod_360, _umod_PI2
19
21
  from pygeodesy.errors import _ValueError, _xkwds, _xkwds_get, _ALL_LAZY, _MODS
20
22
  from pygeodesy.interns import _edge_, _radians_, _semi_circular_, _SPACE_
21
23
  # from pygeodesy.lazily import _ALL_LAZY, _ALL_MODS as _MODS # from .errors
@@ -25,7 +27,7 @@ from pygeodesy.units import Degrees, Degrees_, Feet, Float, Lam, Lam_, \
25
27
  from math import acos, asin, atan2, cos, degrees, fabs, radians, sin, tan # pow
26
28
 
27
29
  __all__ = _ALL_LAZY.utily
28
- __version__ = '24.01.12'
30
+ __version__ = '24.04.04'
29
31
 
30
32
  # read constant name "_M_Unit" as "meter per Unit"
31
33
  _M_CHAIN = _F( 20.1168) # yard2m(1) * 22
@@ -683,7 +685,7 @@ def _sin0cos2(q, r, sign):
683
685
  # else: # r == 0, testUtility failures
684
686
  # t = _0_0, _1_0, _0_0, _N_1_0, _0_0
685
687
  # q &= 3
686
- s = t[q] or (NEG0 if sign < 0 else _0_0)
688
+ s = t[q] or _copysign_0_0(sign)
687
689
  c = t[q + 1] or _0_0
688
690
  return s, c
689
691
 
@@ -691,8 +693,7 @@ def _sin0cos2(q, r, sign):
691
693
  def SinCos2(x):
692
694
  '''Get C{sin} and C{cos} of I{typed} angle.
693
695
 
694
- @arg x: Angle (L{Degrees}, L{Degrees_}, L{Radians}, L{Radians_}
695
- or scalar C{radians}).
696
+ @arg x: Angle (L{Degrees}, L{Radians} or scalar C{radians}).
696
697
 
697
698
  @return: 2-Tuple (C{sin(B{x})}, C{cos(B{x})}).
698
699
  '''