quaternion.js
function() {

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

      var vNorm = Math.sqrt(x * x + y * y + z * z);
      var wExp = Math.exp(w);
      var scale = wExp / vNorm * Math.sin(vNorm);

      if (vNorm === 0) {
        //return new Quaternion(wExp * Math.cos(vNorm), 0, 0, 0);
        return new Quaternion(wExp, 0, 0, 0);
      }

      return new Quaternion(
              wExp * Math.cos(vNorm),
              x * scale,
              y * scale,
              z * scale);
    }
function() {

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

      var vNorm = Math.sqrt(x * x + y * y + z * z);
      var wExp = Math.exp(w);
      var scale = wExp / vNorm * Math.sin(vNorm);

      if (vNorm === 0) {
        //return new Quaternion(wExp * Math.cos(vNorm), 0, 0, 0);
        return new Quaternion(wExp, 0, 0, 0);
      }

      return new Quaternion(
              wExp * Math.cos(vNorm),
              x * scale,
              y * scale,
              z * scale);
    }
function ( ) { var w = this [ 'w' ] ; var x = this [ 'x' ] ; var y = this [ 'y' ] ; var z = this [ 'z' ] ; var vNorm = Math . sqrt ( x * x + y * y + z * z ) ; var wExp = Math . exp ( w ) ; var scale = wExp / vNorm * Math . sin ( vNorm ) ; if ( vNorm === 0 ) { //return new Quaternion(wExp * Math.cos(vNorm), 0, 0, 0); return new Quaternion ( wExp , 0 , 0 , 0 ) ; } return new Quaternion ( wExp * Math . cos ( vNorm ) , x * scale , y * scale , z * scale ) ; }
Calculates the natural exponentiation of the quaternion

@returns {Quaternion}
Calculates the natural exponentiation of the quaternion