Пример #1
0
    def toCartesian(self, Cartesian=Cartesian):
        '''Convert this n-vector to a cartesian point.

           @keyword Cartesian: Optional, cartesion (sub-)class to use
                               for the point (L{Cartesian}).

           @return: Cartesian equivalent to this n-vector (L{Cartesian}).

           @example:

           >>> v = Nvector(0.5, 0.5, 0.7071)
           >>> c = v.toCartesian()  # [3194434, 3194434, 4487327]
           >>> p = c.toLatLon()  # 45.0°N, 45.0°E
        '''
        E = self.datum.ellipsoid

        x, y, z, h = self.to4xyzh()
        # Kenneth Gade eqn (22)
        n = E.b / hypot3(x * E.a_b, y * E.a_b, z)
        r = h + n * E.a_b**2
        return _xnamed(Cartesian(x * r, y * r, z * (n + h)), self.name)
Пример #2
0
 def length(self):
     '''Get the length (norm, magnitude) of this vector (C{float}).
     '''
     if self._length is None:
         self._length = hypot3(self.x, self.y, self.z)
     return self._length
Пример #3
0
 def length(self):
     '''Gets the length of this NED vector (C{meter}).
     '''
     if self._length is None:
         self._length = hypot3(self.north, self.east, self.down)
     return self._length