quaternion.js
function() {

      var w = this['w'];
      var x = this['x'];
      var y = this['y'];
      var z = this['z'];
      var ret = '';

      if (isNaN(w) || isNaN(x) || isNaN(y) || isNaN(z)) {
        return 'NaN';
      }

      // Alternative design?
      // '(%f, [%f %f %f])'

      ret = numToStr(w, '', ret);
      ret += numToStr(x, 'i', ret);
      ret += numToStr(y, 'j', ret);
      ret += numToStr(z, 'k', ret);

      if ('' === ret)
        return '0';

      return ret;
    }
function() {

      var w = this['w'];
      var x = this['x'];
      var y = this['y'];
      var z = this['z'];
      var ret = '';

      if (isNaN(w) || isNaN(x) || isNaN(y) || isNaN(z)) {
        return 'NaN';
      }

      // Alternative design?
      // '(%f, [%f %f %f])'

      ret = numToStr(w, '', ret);
      ret += numToStr(x, 'i', ret);
      ret += numToStr(y, 'j', ret);
      ret += numToStr(z, 'k', ret);

      if ('' === ret)
        return '0';

      return ret;
    }
function ( ) { var w = this [ 'w' ] ; var x = this [ 'x' ] ; var y = this [ 'y' ] ; var z = this [ 'z' ] ; var ret = '' ; if ( isNaN ( w ) || isNaN ( x ) || isNaN ( y ) || isNaN ( z ) ) { return 'NaN' ; } // Alternative design? // '(%f, [%f %f %f])' ret = numToStr ( w , '' , ret ) ; ret += numToStr ( x , 'i' , ret ) ; ret += numToStr ( y , 'j' , ret ) ; ret += numToStr ( z , 'k' , ret ) ; if ( '' === ret ) return '0' ; return ret ; }
Gets the Quaternion as a well formatted string

@returns {string}
Gets the Quaternion as a well formatted string