Package pygeodesy :: Module vector3d |
[frames] | no frames]

# Module vector3d

Generic 3-D vector base class Vector3d, class VectorError and functions intersections2, iscolinearWith, nearestOn, parse3d, sumOf and trilaterate3d2.

Pure Python implementation of vector-based functions by (C) Chris Veness 2011-2015 published under the same MIT Licence**, see Vector-based geodesy.

Version: 21.04.15

Classes
| VectorError Vector3d or `*Nvector` issue.
| Vector3d Generic 3-D vector manipulation.

Functions
intersections2(center1, radius1, center2, radius2, sphere=True, Vector=None, **Vector_kwds) Compute the intersection of two spheres or circles, each defined by a center point and a radius. |
iscolinearWith(point, point1, point2, eps=2.22044604925e-16) Check whether a point is colinear with two other points. |
parse3d(str3d, sep=',', name='', Vector=<class 'pygeodesy.vector3d.Vector3d'>, **Vector_kwds) Parse an `"x, y, z"` string. |
sumOf(vectors, Vector=<class 'pygeodesy.vector3d.Vector3d'>, **Vector_kwds) Compute the vectorial sum of several vectors. |
trilaterate2d2(x1, y1, radius1, x2, y2, radius2, x3, y3, radius3, eps=None) Trilaterate three circles, each given as a (2d) center and a radius. |
trilaterate3d2(center1, radius1, center2, radius2, center3, radius3, eps=2.22044604925e-16, Vector=None, **Vector_kwds) Trilaterate three spheres, each given as a (3d) center and a radius. |

Variables
| __all__ = `_ALL_LAZY.vector3d`

Function Details

### intersections2 (center1, radius1, center2, radius2, sphere=True, Vector=None, **Vector_kwds) |
Compute the intersection of two spheres or circles, each defined by a center point and a radius. Arguments: `center1` - Center of the first sphere or circle (Vector3d, `Vector3Tuple` or `Vector4Tuple`). `radius1` - Radius of the first sphere or circle (same units as the `center1` coordinates). `center2` - Center of the second sphere or circle (Vector3d, `Vector3Tuple` or `Vector4Tuple`). `radius2` - Radius of the second sphere or circle (same units as the `center1` and `center2` coordinates). `sphere` - If `True` compute the center and radius of the intersection of two spheres. If `False`, ignore the `z`-component and compute the intersection of two circles (`bool`). `Vector` - Class to return intersections (Vector3d or `Vector3Tuple`) or `None` for Vector3d. `Vector_kwds` - Optional, additional `Vector` keyword arguments, ignored if `Vector=None`. Returns: If `sphere` is `True`, a 2-Tuple of the `center` and `radius` of the intersection of the spheres. The `radius` is `0.0` for abutting spheres. If `sphere` is `False`, a 2-tuple of the intersection points of two circles. For abutting circles, both points are the same `Vector` instance. Raises: `IntersectionError` - Concentric, invalid or non-intersecting spheres or circles. `UnitError` - Invalid `radius1` or `radius2`. See Also: Sphere-Sphere and circle-circle intersections.

### iscolinearWith (point, point1, point2, eps=2.22044604925e-16) |
Check whether a point is colinear with two other points. Arguments: `point` - The point (Vector3d, `Vector3Tuple` or `Vector4Tuple`). `point1` - First point (Vector3d, `Vector3Tuple` or `Vector4Tuple`). `point2` - Second point (Vector3d, `Vector3Tuple` or `Vector4Tuple`). `eps` - Tolerance (`scalar`), same units as `x`, `y` and `z`. Returns: `True` if `point` is colinear `point1` and `point2`, `False` otherwise. Raises: `TypeError` - Invalid `point`, `point1` or `point2`. See Also: Function nearestOn.

### parse3d (str3d, sep=',', name='', Vector=<class 'pygeodesy.vector3d.Vector3d'>, **Vector_kwds) |
Parse an `"x, y, z"` string. Arguments: `str3d` - X, y and z values (`str`). `sep` - Optional separator (`str`). `name` - Optional instance name (`str`). `Vector` - Optional class (Vector3d). `Vector_kwds` - Optional `Vector` keyword arguments, ignored if `Vector=None`. Returns: New `Vector` or if `Vector` is `None`, a Vector3Tuple`(x, y, z)`. Raises: `VectorError` - Invalid `str3d`.

### sumOf (vectors, Vector=<class 'pygeodesy.vector3d.Vector3d'>, **Vector_kwds) |
Compute the vectorial sum of several vectors. Arguments: `vectors` - Vectors to be added (Vector3d[]). `Vector` - Optional class for the vectorial sum (Vector3d). `Vector_kwds` - Optional `Vector` keyword arguments, ignored if `Vector=None`. Returns: Vectorial sum as `Vector` or if `Vector` is `None`, a Vector3Tuple`(x, y, z)`. Raises: `VectorError` - No `vectors`.

### trilaterate2d2 (x1, y1, radius1, x2, y2, radius2, x3, y3, radius3, eps=None) |
Trilaterate three circles, each given as a (2d) center and a radius. Arguments: `x1` - Center `x` coordinate of the 1st circle (`scalar`). `y1` - Center `y` coordinate of the 1st circle (`scalar`). `radius1` - Radius of the 1st circle (`scalar`). `x2` - Center `x` coordinate of the 2nd circle (`scalar`). `y2` - Center `y` coordinate of the 2nd circle (`scalar`). `radius2` - Radius of the 2nd circle (`scalar`). `x3` - Center `x` coordinate of the 3rd circle (`scalar`). `y3` - Center `y` coordinate of the 3rd circle (`scalar`). `radius3` - Radius of the 3rd circle (`scalar`). `eps` - Check the trilaterated point delta on all 3 circles (`scalar`) or `None`. Returns: Trilaterated point as Vector2Tuple`(x, y)`. Raises: `IntersectionError` - No intersection, colinear or near-concentric centers, trilateration failed some other way or the trilaterated point is off one circle by more than `eps`. `UnitError` - Invalid `radius1`, `radius2` or `radius3`. See Also: Issue #49, Find X location using 3 known (X,Y) location using trilateration and trilaterate3d2

### trilaterate3d2 (center1, radius1, center2, radius2, center3, radius3, eps=2.22044604925e-16, Vector=None, **Vector_kwds) |
Trilaterate three spheres, each given as a (3d) center and a radius. Arguments: `center1` - Center of the 1st sphere (Vector3d, `Vector3Tuple` or `Vector4Tuple`). `radius1` - Radius of the 1st sphere (same `units` as `x`, `y` and `z`). `center2` - Center of the 2nd sphere (Vector3d, `Vector3Tuple` or `Vector4Tuple`). `radius2` - Radius of this sphere (same `units` as `x`, `y` and `z`). `center3` - Center of the 3rd sphere (Vector3d, `Vector3Tuple` or `Vector4Tuple`). `radius3` - Radius of the 3rd sphere (same `units` as `x`, `y` and `z`). `eps` - Tolerance (`scalar`), same units as `x`, `y`, and `z`. `Vector` - Class to return intersections (Vector3d or `Vector3Tuple`) or `None` for Vector3d. `Vector_kwds` - Optional, additional `Vector` keyword arguments, ignored if `Vector=None`. Returns: 2-Tuple with two trilaterated points, each a `Vector` instance. Both points are the same instance if all three spheres abut/intersect in a single point. Raises: `ImportError` - Package `numpy` not found, not installed or older than version 1.15. `IntersectionError` - No intersection, colinear or near-concentric centers or trilateration failed some other way. `TypeError` - Invalid `center1`, `center2` or `center3`. `UnitError` - Invalid `radius1`, `radius2` or `radius3`. Note: Package numpy is required, version 1.15 or later. See Also: Norrdine, A. An Algebraic Solution to the Multilateration Problem and implementation and trilaterate2d2.