Package pygeodesy :: Module nvector :: Class Nvector
[frames] | no frames]

Class Nvector

   object --+        
            |        
   bases.Base --+    
                |    
vector3d.Vector3d --+
                    |
                   Nvector
Known Subclasses:

Base class for ellipsoidal and spherical Nvector.

Instance Methods
 
__init__(self, x, y, z, h=0)
New n-vector normal to the earth's surface.
 
copy(self)
Copy this vector.
 
to3llh(self)
Converts this n-vector to (geodetic) lat-, longitude and height.
 
to4xyzh(self)
Returns this n-vector as a 4-tuple.
 
toStr(self, prec=5, fmt='(%s)', sep=', ')
Returns a string representation of this n-vector.
 
unit(self, h=0)
Normalized this vectors to unit length.

Inherited from vector3d.Vector3d: __abs__, __add__, __cmp__, __div__, __eq__, __ge__, __gt__, __iadd__, __imatmul__, __imul__, __isub__, __itruediv__, __le__, __lt__, __matmul__, __mul__, __ne__, __neg__, __pos__, __radd__, __rmatmul__, __rmul__, __rsub__, __sub__, __truediv__, angleTo, cross, dividedBy, dot, equals, minus, negate, others, parse, plus, rotate, rotateAround, sum, times, to2ll, to3xyz

Inherited from bases.Base: __repr__, __str__, classname, toStr2, topsub

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Class Variables
  H = ''
Heigth prefix (string), '↑' in JS version
Properties
  h
Gets the height above surface (meter).

Inherited from vector3d.Vector3d: length, x, y, z

Inherited from object: __class__

Method Details

__init__(self, x, y, z, h=0)
(Constructor)

 

New n-vector normal to the earth's surface.

Parameters:
  • x - X component (scalar).
  • y - Y component (scalar).
  • z - Z component (scalar).
  • h - Height above surface (meter).
Overrides: object.__init__

Example:

>>> from sphericalNvector import Nvector
>>> v = Nvector(0.5, 0.5, 0.7071, 1)
>>> v.toLatLon()  # 45.0°N, 045.0°E, +1.00m

copy(self)

 

Copy this vector.

Returns:
Copy (Nvector).
Overrides: vector3d.Vector3d.copy

to3llh(self)

 

Converts this n-vector to (geodetic) lat-, longitude and height.

Returns:
3-Tuple (lat, lon, height) in (degrees90, degrees180, meter).

to4xyzh(self)

 

Returns this n-vector as a 4-tuple.

Returns:
4-Tuple (x, y, z, h) in (meter).

toStr(self, prec=5, fmt='(%s)', sep=', ')

 

Returns a string representation of this n-vector.

Height component is only included if non-zero.

Parameters:
  • prec - Number of decimals, unstripped (int).
  • fmt - Enclosing backets format (string).
  • sep - Separator between components (string).
Returns:
Comma-separated "x, y, z [, h]" (string).
Overrides: bases.Base.toStr

Example:

>>> Nvector(0.5, 0.5, 0.7071).toStr()  # (0.5, 0.5, 0.7071)
>>> Nvector(0.5, 0.5, 0.7071, 1).toStr(-3)  # (0.500, 0.500, 0.707, +1.00)

unit(self, h=0)

 

Normalized this vectors to unit length.

Parameters:
  • h - Optional height (meter).
Returns:
Normalized vector (Nvector).
Overrides: vector3d.Vector3d.unit

Property Details

h

Gets the height above surface (meter).

Get Method:
h(self) - Gets the height above surface (meter).
Set Method:
h(self, h) - Sets height above surface.