Package pygeodesy :: Module vector3dBase :: Class Vector3dBase |
[frames] | no frames]

# Class Vector3dBase

      object --+
               |
    named._Named --+
                   |
    named._NamedBase --+
                       |
                      Vector3dBase

Known Subclasses:
  - vector3d.Vector3d

(INTERNAL) Generic 3-D vector base class.

In a geodesy context, these may be used to represent:

- n-vector representing a normal to point on earth's surface
- earth-centered, earth-fixed cartesian (= spherical n-vector)
- great circle normal to vector
- motion vector on earth's surface
- etc.

Instance Methods
__init__(self, x, y, z=0, ll=None, name='') New Vector3d or `Vector3dBase` instance. |
__abs__(self) Return the norm of this vector. |
__add__(self, other) Add this to an other vector (Vector3d). |
__radd__(self, other) Add this to an other vector (Vector3d). |
__cmp__(self, other) Compare this and an other vector |
cmp(self, other) Compare this and an other vector |
__div__(self, scalar) Divide this vector by a scalar. |
__truediv__(self, scalar) Divide this vector by a scalar. |
__eq__(self, other) Is this vector equal to an other vector? |
__ge__(self, other) Is this vector longer than or equal to an other vector? |
__gt__(self, other) Is this vector longer than an other vector? |
__le__(self, other) Is this vector shorter than or equal to an other vector? |
__lt__(self, other) Is this vector shorter than an other vector? |
__matmul__(self, other) Compute the cross product of this and an other vector. |
__mul__(self, scalar) Multiply this vector by a scalar |
__ne__(self, other) Is this vector not equal to an other vector? |
__neg__(self) Negate this vector. |
__pos__(self) Copy this vector. |
__rmatmul__(self, other) Compute the cross product of an other and this vector. |
__rsub__(self, other) Subtract this vector from an other vector. |
__sub__(self, other) Subtract an other vector from this vector. |
angleTo(self, other, vSign=None, wrap=False) Compute the angle between this and an other vector. |
apply(self, fun2, other_x, *y_z, **fun2_kwds) Apply a function component-wise to this and an other vector. |
cross(self, other, raiser=None) Compute the cross product of this and an other vector. |
dividedBy(self, factor) Divide this vector by a scalar. |
dot(self, other) Compute the dot (scalar) product of this and an other vector. |
equals(self, other, units=False) DEPRECATED, use method `isequalTo`. |
isconjugateTo(self, other, minum=1, eps=2.22044604925e-16) Determine whether this and an other vector are conjugates. |
isequalTo(self, other, units=False, eps=2.22044604925e-16) Check if this and an other vector are equal or equivalent. |
minus(self, other) Subtract an other vector from this vector. |
negate(self) Return this vector in opposite direction. |
others(self, *other, **name_other_up) Refined class comparison. |
plus(self, other) Add this vector and an other vector. |
sum(self, other) Add this vector and an other vector. |
rotate(self, axis, theta) Rotate this vector around an axis by a specified angle. |
rotateAround(self, axis, theta) DEPRECATED, use method `rotate`. |
times(self, factor) Multiply this vector by a scalar. |
times_(self, other_x, *y_z) Multiply this vector's components by separate scalars. |
to2ab(self) DEPRECATED, use property `Nvector.philam`. |
to2ll(self) DEPRECATED, use property `Nvector.latlon`. |
to3xyz(self) DEPRECATED, use property xyz. |
toStr(self, prec=5, fmt='(%s)', sep=', ') Return a string representation of this vector. |
unit(self, ll=None) Normalize this vector to unit length. |
Inherited from `named._NamedBase`: `__repr__`, `__str__`, `toRepr` Inherited from `named._Named`: `_DOT_`, `attrs`, `classof`, `copy`, `rename`, `toStr2` Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__setattr__`, `__sizeof__`, `__subclasshook__`

Properties
| crosserrors Property to raise or ignore CrossError exceptions (`bool`).
| euclid Approximate the length (norm, magnitude) of this vector.
| length Get the length (norm, magnitude) of this vector (`float`).
| length2 Get the length squared of this vector (`float`).
| x Get the X component (`float`).
| xyz Get the X, Y and Z components (Vector3Tuple`(x, y, z)`).
| x2y2z2 Get the X, Y and Z components squared (`Vector3Tuple``(x2, y2, z2)`).
| y Get the Y component (`float`).
| z Get the Z component (`float`).
Inherited from `named._Named`: `classname`, `classnaming`, `name`, `named`, `named2`, `named3`, `named4` Inherited from `object`: `__class__`

Method Details

### __init__ (self, x, y, z=0, ll=None, name='') (Constructor) |
New Vector3d or `Vector3dBase` instance. The vector may be normalised or use x, y, z for position and height relative to the surface of the sphere or ellipsoid, distance from earth centre. Arguments: `x` - X component of vector (`scalar`). `y` - Y component of vector (`scalar`), same units as `x`. `z` - Z component of vector (`scalar`), same units as `x`. `ll` - Optional latlon reference (`LatLon`). `name` - Optional name (`str`). Overrides: object.__init__

### __abs__ (self) |
Return the norm of this vector. Returns: Norm, unit length (`float`);

### __add__ (self, other) (Addition operator) |
Add this to an other vector (Vector3d). Returns: Vectorial sum (Vector3d). Raises: `TypeError` - Incompatible `other` `type`.

### __radd__ (self, other) (Right-side addition operator) |
Add this to an other vector (Vector3d). Returns: Vectorial sum (Vector3d). Raises: `TypeError` - Incompatible `other` `type`.

### __cmp__ (self, other) (Comparison operator) |
Compare this and an other vector Arguments: `other` - The other vector (Vector3d). Returns: -1, 0 or +1 (`int`). Raises: `TypeError` - Incompatible `other` `type`.

### cmp (self, other) |
Compare this and an other vector Arguments: `other` - The other vector (Vector3d). Returns: -1, 0 or +1 (`int`). Raises: `TypeError` - Incompatible `other` `type`.

### __div__ (self, scalar) |
Divide this vector by a scalar. Arguments: `scalar` - The divisor (`scalar`). Returns: Quotient (Vector3d). Raises: `TypeError` - Non-scalar `scalar`.

### __truediv__ (self, scalar) |
Divide this vector by a scalar. Arguments: `scalar` - The divisor (`scalar`). Returns: Quotient (Vector3d). Raises: `TypeError` - Non-scalar `scalar`.

### __eq__ (self, other) (Equality operator) |
Is this vector equal to an other vector? Arguments: `other` - The other vector (Vector3d). Returns: `True` if equal, `False` otherwise. Raises: `TypeError` - Incompatible `other` `type`.

### __ge__ (self, other) (Greater-than-or-equals operator) |
Is this vector longer than or equal to an other vector? Arguments: `other` - The other vector (Vector3d). Returns: `True` if so, `False` otherwise. Raises: `TypeError` - Incompatible `other` `type`.

### __gt__ (self, other) (Greater-than operator) |
Is this vector longer than an other vector? Arguments: `other` - The other vector (Vector3d). Returns: `True` if so, `False` otherwise. Raises: `TypeError` - Incompatible `other` `type`.

### __le__ (self, other) (Less-than-or-equals operator) |
Is this vector shorter than or equal to an other vector? Arguments: `other` - The other vector (Vector3d). Returns: `True` if so, `False` otherwise. Raises: `TypeError` - Incompatible `other` `type`.

### __lt__ (self, other) (Less-than operator) |
Is this vector shorter than an other vector? Arguments: `other` - The other vector (Vector3d). Returns: `True` if so, `False` otherwise. Raises: `TypeError` - Incompatible `other` `type`.

### __matmul__ (self, other) |
Compute the cross product of this and an other vector. Arguments: `other` - The other vector (Vector3d). Returns: Cross product (Vector3d). Raises: `TypeError` - Incompatible `other` `type`.

### __mul__ (self, scalar) |
Multiply this vector by a scalar Arguments: `scalar` - Factor (`scalar`). Returns: Product (Vector3d).

### __ne__ (self, other) |
Is this vector not equal to an other vector? Arguments: `other` - The other vector (Vector3d). Returns: `True` if so, `False` otherwise. Raises: `TypeError` - Incompatible `other` `type`.

### __neg__ (self) |
Negate this vector. Returns: Negative (Vector3d)

### __pos__ (self) |
Copy this vector. Returns: Positive (Vector3d)

### __rmatmul__ (self, other) |
Compute the cross product of an other and this vector. Arguments: `other` - The other vector (Vector3d). Returns: Cross product (Vector3d). Raises: `TypeError` - Incompatible `other` `type`.

### __rsub__ (self, other) |
Subtract this vector from an other vector. Arguments: `other` - The other vector (Vector3d). Returns: Difference (Vector3d). Raises: `TypeError` - Incompatible `other` `type`.

### __sub__ (self, other) (Subtraction operator) |
Subtract an other vector from this vector. Arguments: `other` - The other vector (Vector3d). Returns: Difference (Vector3d). Raises: `TypeError` - Incompatible `other` `type`.

### angleTo (self, other, vSign=None, wrap=False) |
Compute the angle between this and an other vector. Arguments: `other` - The other vector (Vector3d). `vSign` - Optional vector, if supplied (and out of the plane of this and the other), angle is signed positive if this->other is clockwise looking along vSign or negative in opposite direction, otherwise angle is unsigned. `wrap` - Wrap/unroll the angle to +/-PI (`bool`). Returns: Angle (`radians`). Raises: `TypeError` - If `other` or `vSign` not a Vector3d.

### apply (self, fun2, other_x, *y_z, **fun2_kwds) |
Apply a function component-wise to this and an other vector. Arguments: `fun2` - 2-Argument callable (`any(scalar, scalar`). `other_x` - An other vector factors (Vector3dBase, Vector3Tuple, Vector4Tuple, Ecef9Tuple cartesian) or X scale factor (`scalar`). `y_z` - Y and Z scale factors (`scalar`, `scalar`). `fun2_kwds` - Optional keyword argument for `fun2`. Returns: New, applied vector (Vector3d). Raises: `ValueError` - Invalid `other_x` or `y_z`.

### cross (self, other, raiser=None) |
Compute the cross product of this and an other vector. Arguments: `other` - The other vector (Vector3d). `raiser` - Optional, CrossError label if raised (`str`). Returns: Cross product (Vector3d). Raises: `CrossError` - Zero or near-zero cross product and both `raiser` and crosserrors set. `TypeError` - Incompatible `other` `type`.

### dividedBy (self, factor) |
Divide this vector by a scalar. Arguments: `factor` - The divisor (`scalar`). Returns: New, scaled vector (Vector3d). Raises: `TypeError` - Non-scalar `factor`. `VectorError` - Invalid or zero `factor`.

### dot (self, other) |
Compute the dot (scalar) product of this and an other vector. Arguments: `other` - The other vector (Vector3d). Returns: Dot product (`float`). Raises: `TypeError` - Incompatible `other` `type`.

### equals (self, other, units=False) |
DEPRECATED, use method `isequalTo`. Decorators: `@deprecated_method`

### isconjugateTo (self, other, minum=1, eps=2.22044604925e-16) |
Determine whether this and an other vector are conjugates. Arguments: `other` - The other vector (Vector3d, `Vector3Tuple` or `Vector4Tuple`). `minum` - Minimal number of conjugates (`int`, 0..3). `eps` - Tolerance for equality and conjugation (`scalar`), same units as `x`, `y`, and `z`. Returns: `True` if `x`, `y` and `z` have equal an absolute value and at least `minum` have opposite signs. Raises: `TypeError` - Incompatible `other` `type`. See Also: Method `isequalTo`.

### isequalTo (self, other, units=False, eps=2.22044604925e-16) |
Check if this and an other vector are equal or equivalent. Arguments: `other` - The other vector (Vector3d). `units` - Optionally, compare the normalized, unit version of both vectors. `eps` - Tolerance for equality (`scalar`), same units as `x`, `y`, and `z`. Returns: `True` if vectors are identical, `False` otherwise. Raises: `TypeError` - Incompatible `other` `type`. See Also: Method `isconjugateTo`.

### minus (self, other) |
Subtract an other vector from this vector. Arguments: `other` - The other vector (Vector3d). Returns: New vector difference (Vector3d). Raises: `TypeError` - Incompatible `other` `type`.

### negate (self) |
Return this vector in opposite direction. Returns: New, opposite vector (Vector3d).

### others (self, *other, **name_other_up) |
Refined class comparison. Arguments: `other` - The other vector (Vector3d). `name_other_up` - Overriding `name=other` and `up=1` keyword arguments. Returns: The `other` if compatible. Raises: `TypeError` - Incompatible `other` `type`. Overrides: named._NamedBase.others

### plus (self, other) |
Add this vector and an other vector. Arguments: `other` - The other vector (Vector3d). Returns: Vectorial sum (Vector3d). Raises: `TypeError` - Incompatible `other` `type`.

### sum (self, other) |
Add this vector and an other vector. Arguments: `other` - The other vector (Vector3d). Returns: Vectorial sum (Vector3d). Raises: `TypeError` - Incompatible `other` `type`.

### rotate (self, axis, theta) |
Rotate this vector around an axis by a specified angle. See Rotation matrix from axis and angle and Quaternion-derived rotation matrix. Arguments: `axis` - The axis being rotated around (Vector3d). `theta` - The angle of rotation (`radians`). Returns: New, rotated vector (Vector3d). JS name: rotateAround.

### rotateAround (self, axis, theta) |
DEPRECATED, use method `rotate`. Decorators: `@deprecated_method`

### times (self, factor) |
Multiply this vector by a scalar. Arguments: `factor` - Scale factor (`scalar`). Returns: New, scaled vector (Vector3d). Raises: `TypeError` - Non-scalar `factor`.

### times_ (self, other_x, *y_z) |
Multiply this vector's components by separate scalars. Arguments: `other_x` - An other vector factors (Vector3dBase, Vector3Tuple, Vector4Tuple, Ecef9Tuple cartesian) or X scale factor (`scalar`). `y_z` - Y and Z scale factors (`scalar`, `scalar`). Returns: New, scaled vector (Vector3d). Raises: `ValueError` - Invalid `other_x` or `y_z`.

### to2ab (self) |
DEPRECATED, use property `Nvector.philam`. Returns: A PhiLam2Tuple`(phi, lam)`. Decorators: `@deprecated_method`

### to2ll (self) |
DEPRECATED, use property `Nvector.latlon`. Returns: A LatLon2Tuple`(lat, lon)`. Decorators: `@deprecated_method`

### to3xyz (self) |
DEPRECATED, use property xyz. Decorators: `@deprecated_method`

### toStr (self, prec=5, fmt='(%s)', sep=', ') |
Return a string representation of this vector. Arguments: `prec` - Optional number of decimal places (`int`). `fmt` - Optional, enclosing format to use (`str`). `sep` - Optional separator between components (`str`). Returns: Vector as "(x, y, z)" (`str`). Overrides: named._Named.toStr

### unit (self, ll=None) |
Normalize this vector to unit length. Arguments: `ll` - Optional, original location (`LatLon`). Returns: Normalized vector (Vector3d).

Property Details

### crosserrors Property to raise or ignore CrossError exceptions (`bool`). Get method: crosserrors(self) - Get CrossError exceptions (`bool`). Set method: crosserrors(self, raiser) - Raise CrossError exceptions (`bool`).

### euclid Approximate the length (norm, magnitude) of this vector. Get method: euclid(self) - Approximate the length (norm, magnitude) of this vector. Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value. See Also: Function euclid_ and properties `length` and `length2`.

### length Get the length (norm, magnitude) of this vector (`float`). Get method: length(self) - Get the length (norm, magnitude) of this vector (`float`). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value. See Also: Properties length2 and euclid.

### length2 Get the length squared of this vector (`float`). Get method: length2(self) - Get the length squared of this vector (`float`). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value. See Also: Property length.

### x Get the X component (`float`). Get method: x(self) - Get the X component (`float`). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### xyz Get the X, Y and Z components (Vector3Tuple`(x, y, z)`). Get method: xyz(self) - Get the X, Y and Z components (Vector3Tuple`(x, y, z)`). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### x2y2z2 Get the X, Y and Z components squared (`Vector3Tuple``(x2, y2, z2)`). Get method: x2y2z2(self) - Get the X, Y and Z components squared (`Vector3Tuple``(x2, y2, z2)`). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### y Get the Y component (`float`). Get method: y(self) - Get the Y component (`float`). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### z Get the Z component (`float`). Get method: z(self) - Get the Z component (`float`). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.