def toStr(self, prec=3, fmt='[%s]', sep=', '): # PYCHOK expected '''Return the string representation of this cartesian. @keyword prec: Optional number of decimals, unstripped (C{int}). @keyword fmt: Optional enclosing backets format (string). @keyword sep: Optional separator to join (string). @return: Cartesian represented as "[x, y, z]" (string). ''' return Vector3d.toStr(self, prec=prec, fmt=fmt, sep=sep)
def toStr(self, prec=3, fmt=Fmt.SQUARE, sep=_COMMASPACE_): # PYCHOK expected '''Return the string representation of this cartesian. @kwarg prec: Optional number of decimals, unstripped (C{int}). @kwarg fmt: Optional enclosing backets format (string). @kwarg sep: Optional separator to join (string). @return: Cartesian represented as "[x, y, z]" (string). ''' return Vector3d.toStr(self, prec=prec, fmt=fmt, sep=sep)
def toStr(self, prec=5, fmt='(%s)', sep=', '): # PYCHOK expected '''Return a string representation of this n-vector. Height component is only included if non-zero. @kwarg prec: Optional number of decimals, unstripped (C{int}). @kwarg fmt: Optional enclosing backets format (C{str}). @kwarg sep: Optional separator between components (C{str}). @return: Comma-separated C{"(x, y, z [, h])"} enclosed in B{C{fmt}} brackets (C{str}). @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) ''' t = Vector3d.toStr(self, prec=prec, fmt='%s', sep=sep) if self.h: t = '%s%s%s%+.2f' % (t, sep, self.H, self.h) return fmt % (t, )
def toStr(self, prec=5, fmt=_PARENTH_, sep=_COMMA_SPACE_): # PYCHOK expected '''Return a string representation of this n-vector. Height component is only included if non-zero. @kwarg prec: Optional number of decimals, unstripped (C{int}). @kwarg fmt: Optional enclosing backets format (C{str}). @kwarg sep: Optional separator between components (C{str}). @return: Comma-separated C{"(x, y, z [, h])"} enclosed in B{C{fmt}} brackets (C{str}). @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) ''' t = Vector3d.toStr(self, prec=prec, fmt=NN, sep=sep) if self.h: t = sep.join((t, self.hStr())) return t if not fmt else (fmt % (t,))