Coverage for pygeodesy/resections.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 -*-
'''
_A_, _B_, _C_, _coincident_, _colinear_, \ _invalid_, _negative_, _SPACE_, \ _1_0, _N_1_0, _360_0 # from pygeodesy.streprs import Fmt # from .named
'''5-Tuple C{(pointP, pointH, a, b, c)} with survey C{pointP}, auxiliary C{pointH}, each an instance of B{C{pointA}}'s (sub-)class and triangle sides C{a}, C{b} and C{c} in C{meter}, conventionally. '''
'''Error raised for resection issues. '''
'''7-Tuple C{(pointP, A, B, C, a, b, c)} with survey C{pointP}, interior triangle angles C{A}, C{B} and C{C} in C{degrees} and triangle sides C{a}, C{b} and C{c} in C{meter}, conventionally. '''
'''3-Point resection using U{Cassini<https://NL.WikiPedia.org/wiki/Achterwaartse_insnijding>}'s method.
@arg pointA: First point (C{Cartesian}, L{Vector3d}, C{Vector3Tuple}, C{Vector4Tuple} or C{Vector2Tuple} if C{B{useZ}=False}). @arg pointB: Second point (C{Cartesian}, L{Vector3d}, C{Vector3Tuple}, C{Vector4Tuple} or C{Vector2Tuple} if C{B{useZ}=False}). @arg pointC: Center point (C{Cartesian}, L{Vector3d}, C{Vector3Tuple}, C{Vector4Tuple} or C{Vector2Tuple} if C{B{useZ}=False}). @arg alpha: Angle subtended by triangle side B{C{pointA}} to B{C{pointC}} (C{degrees}, non-negative). @arg beta: Angle subtended by triangle side B{C{pointB}} to B{C{pointC}} (C{degrees}, non-negative). @kwarg useZ: If C{True}, use and interpolate the Z component, otherwise force C{z=0} (C{bool}).
@note: B{C{PointC}} is between B{C{pointA}} and B{C{pointB}}, typically.
@return: Survey point, an instance of B{C{pointA}}'s (sub-)class.
@raise ResectionError: Near-coincident, -colinear or -concyclic points or negative or invalid B{C{alpha}} or B{C{beta}}.
@raise TypeError: Invalid B{C{pointA}}, B{C{pointB}} or B{C{pointM}}.
@see: U{Three Point Resection Problem<https://Dokumen.tips/documents/ three-point-resection-problem-introduction-kaestner-burkhardt-method.html>} and functions L{pygeodesy.collins} and L{pygeodesy.tienstra}. ''' _otherV3d(useZ=useZ, pointB=pointB), _otherV3d(useZ=useZ, pointC=pointC), alpha, beta, useZ=useZ, clas=pointA.classof) except (TypeError, ValueError) as x: raise ResectionError(pointA=pointA, pointB=pointB, pointC=pointC, alpha=alpha, beta=beta, txt=str(x))
# (INTERNAL) Cassini's 3-point resection, note pointC == -M in reference
raise ValueError(_or(_coincident_, _colinear_))
raise ValueError(_negative_) raise ValueError(_invalid_)
raise ValueError(_SPACE_(_concyclic_, (x, y)))
raise ValueError(_SPACE_(_concyclic_, (N, n, m)))
'''3-Point resection using U{Collins<https://Dokumen.tips/documents/ three-point-resection-problem-introduction-kaestner-burkhardt-method.html>}' method.
@arg pointA: First point (C{Cartesian}, L{Vector3d}, C{Vector3Tuple}, C{Vector4Tuple} or C{Vector2Tuple} if C{B{useZ}=False}). @arg pointB: Second point (C{Cartesian}, L{Vector3d}, C{Vector3Tuple}, C{Vector4Tuple} or C{Vector2Tuple} if C{B{useZ}=False}). @arg pointC: Center point (C{Cartesian}, L{Vector3d}, C{Vector3Tuple}, C{Vector4Tuple} or C{Vector2Tuple} if C{B{useZ}=False}). @arg alpha: Angle subtended by triangle side B{C{pointA}} to B{C{pointC}} (C{degrees}, non-negative). @arg beta: Angle subtended by triangle side B{C{pointB}} to B{C{pointC}} (C{degrees}, non-negative). @kwarg useZ: If C{True}, use and interpolate the Z component, otherwise force C{z=0} (C{bool}).
@note: B{C{PointC}} is between B{C{pointA}} and B{C{pointB}}, typically.
@return: L{Collins5Tuple}C{(pointP, pointH, a, b, c)} with survey C{pointP}, auxiliary C{pointH}, each an instance of B{C{pointA}}'s (sub-)class and triangle sides C{a}, C{b} and C{c}.
@raise ResectionError: Near-coincident, -colinear or -concyclic points or negative or invalid B{C{alpha}} or B{C{beta}}.
@raise TypeError: Invalid B{C{pointA}}, B{C{pointB}} or B{C{pointM}}.
@see: U{Collins' methode<https://NL.WikiPedia.org/wiki/Achterwaartse_insnijding>} and functions L{pygeodesy.cassini} and L{pygeodesy.tienstra}. ''' _otherV3d(useZ=useZ, pointB=pointB), _otherV3d(useZ=useZ, pointC=pointC), alpha, beta, useZ=useZ, clas=pointA.classof) except (TypeError, ValueError) as x: raise ResectionError(pointA=pointA, pointB=pointB, pointC=pointC, alpha=alpha, beta=beta, txt=str(x))
# (INTERNAL) Collins' 3-point resection, note C{pointC} center
raise ValueError(_negative_)
raise ValueError(_or(_coincident_, _colinear_, _concyclic_))
# za, a = _azi_len2(C, B, PI2)
# d = c * sin(PI - rb) / srH # B.minus(H).length
# d = a * sin(za - zh) / sin(rb) # B.minus(P).length
'''3-Point resection using U{Tienstra<https://WikiPedia.org/wiki/Tienstra_formula>}'s formula.
@arg pointA: First point (C{Cartesian}, L{Vector3d}, C{Vector3Tuple}, C{Vector4Tuple} or C{Vector2Tuple} if C{B{useZ}=False}). @arg pointB: Second point (C{Cartesian}, L{Vector3d}, C{Vector3Tuple}, C{Vector4Tuple} or C{Vector2Tuple} if C{B{useZ}=False}). @arg pointC: Third point (C{Cartesian}, L{Vector3d}, C{Vector3Tuple}, C{Vector4Tuple} or C{Vector2Tuple} if C{B{useZ}=False}). @arg alpha: Angle subtended by triangle side B{C{pointB}} to B{C{pointC}} (C{degrees}, non-negative). @kwarg beta: Angle subtended by triangle side B{C{pointA}} to B{C{pointC}} (C{degrees}, non-negative) or C{None} if C{B{gamma} is not None}. @kwarg gamma: Angle subtended by triangle side B{C{pointA}} to B{C{pointB}} (C{degrees}, non-negative) or C{None} if C{B{beta} is not None}. @kwarg useZ: If C{True}, use and interpolate the Z component, otherwise force C{z=0} (C{bool}).
@note: Points B{C{pointA}}, B{C{pointB}} and B{C{pointC}} are ordered clockwise.
@return: L{Tienstra7Tuple}C{(pointP, A, B, C, a, b, c)} with survey C{pointP}, an instance of B{C{pointA}}'s (sub-)class and triangle angles C{A}, C{B} and C{C} in C{degrees} and triangle sides C{a}, C{b} and C{c}.
@raise ResectionError: Near-coincident, -colinear or -concyclic points or sum of B{C{alpha}}, B{C{beta}} and B{C{gamma}} not C{360} or negative B{C{alpha}}, B{C{beta}} or B{C{gamma}}.
@raise TypeError: Invalid B{C{pointA}}, B{C{pointB}} or B{C{pointC}}.
@see: U{3-Point Resection Solver<http://MesaMike.org/geocache/GC1B0Q9/tienstra/>}, U{V. Pierlot, M. Van Droogenbroeck, "A New Three Object Triangulation..." <http://Telecom.ULG.ac.BE/publi/publications/pierlot/Pierlot2014ANewThree/>}, U{18 Triangulation Algorithms...<http://Telecom.ULG.ac.BE/triangulation/>} and functions L{pygeodesy.cassini} and L{pygeodesy.collins}. ''' _otherV3d(useZ=useZ, pointB=pointB), _otherV3d(useZ=useZ, pointC=pointC), alpha, beta, gamma, useZ=useZ, clas=pointA.classof) except (TypeError, ValueError) as x: raise ResectionError(pointA=pointA, pointB=pointB, pointC=pointC, alpha=alpha, beta=beta, gamma=gamma, txt=str(x))
# (INTERNAL) Tienstra's 3-point resection
raise ValueError(Fmt.PARENSPACED(concyclic=N)) # k = 1 / (cot(r) - cot(s)) # = 1 / (cos(r) / sin(r) - cos(s) / sin(s)) # = 1 / (cos(r) * sin(s) - cos(s) * sin(r)) / (sin(r) * sin(s)) # = sin(r) * sin(s) / (cos(r) * sin(s) - cos(s) * sin(r)) raise ValueError(Fmt.PARENSPACED(cotan=N))
raise ValueError(_and(Fmt.EQUAL(beta=beta), Fmt.EQUAL(gamma=gamma))) sc = fsum1_(PI2, -sa, -sb) else: # subtended angles must add to 360 degrees raise ValueError(Fmt.EQUAL(sum=degrees(r))) raise ValueError(_negative_)
# triangle sides
raise ValueError(Fmt.EQUAL(K=k))
# interpolate z or coplanar with A, B and C? t = A.z, B.z, C.z v = Vector3d(x, y, fmean(t)) return fidw(t, (v.minus(A).length, v.minus(B).length, v.minus(C).length))
# **) MIT License # # Copyright (C) 2016-2021 -- 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. |