function transformQuat(out, a, q) {
      // benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed
      var qx = q[0],
          qy = q[1],
          qz = q[2],
          qw = q[3];
      var x = a[0],
          y = a[1],
          z = a[2]; // var qvec = [qx, qy, qz];
      // var uv = vec3.cross([], qvec, a);

      var uvx = qy * z - qz * y,
          uvy = qz * x - qx * z,
          uvz = qx * y - qy * x; // var uuv = vec3.cross([], qvec, uv);

      var uuvx = qy * uvz - qz * uvy,
          uuvy = qz * uvx - qx * uvz,
          uuvz = qx * uvy - qy * uvx; // vec3.scale(uv, uv, 2 * w);

      var w2 = qw * 2;
      uvx *= w2;
      uvy *= w2;
      uvz *= w2; // vec3.scale(uuv, uuv, 2);

      uuvx *= 2;
      uuvy *= 2;
      uuvz *= 2; // return vec3.add(out, a, vec3.add(out, uv, uuv));

      out[0] = x + uvx + uuvx;
      out[1] = y + uvy + uuvy;
      out[2] = z + uvz + uuvz;
      return out;
    }
/**
     * Transforms the vec3 with a quat
     * Can also be used for dual quaternions. (Multiply it with the real part)
     *
     * @param {vec3} out the receiving vector
     * @param {ReadonlyVec3} a the vector to transform
     * @param {ReadonlyQuat} q quaternion to transform with
     * @returns {vec3} out
     */
Transforms the vec3 with a quat
Can also be used for dual quaternions. (Multiply it with the real part)

@param {vec3} out the receiving vector
@param {ReadonlyVec3} a the vector to transform
@param {ReadonlyQuat} q quaternion to transform with
@returns {vec3} out
Transforms the vec3 with a quat Can also be used for dual quaternions . ( Multiply it with the real part ) @param { vec3 } out the receiving vector @param { ReadonlyVec3 } a the vector to transform @param { ReadonlyQuat } q quaternion to transform with @returns { vec3 } out
function transformQuat(out, a, q) {
      var qx = q[0],
          qy = q[1],
          qz = q[2],
          qw = q[3];
      var x = a[0],
          y = a[1],
          z = a[2]; 
      var uvx = qy * z - qz * y,
          uvy = qz * x - qx * z,
          uvz = qx * y - qy * x; 
      var uuvx = qy * uvz - qz * uvy,
          uuvy = qz * uvx - qx * uvz,
          uuvz = qx * uvy - qy * uvx; 
      var w2 = qw * 2;
      uvx *= w2;
      uvy *= w2;
      uvz *= w2; 
      uuvx *= 2;
      uuvy *= 2;
      uuvz *= 2; 
      out[0] = x + uvx + uuvx;
      out[1] = y + uvy + uuvy;
      out[2] = z + uvz + uuvz;
      return out;
    }
function transformQuat ( out , a , q ) { var qx = q [ 0 ] , qy = q [ 1 ] , qz = q [ 2 ] , qw = q [ 3 ] ; var x = a [ 0 ] , y = a [ 1 ] , z = a [ 2 ] ; var uvx = qy * z - qz * y , uvy = qz * x - qx * z , uvz = qx * y - qy * x ; var uuvx = qy * uvz - qz * uvy , uuvy = qz * uvx - qx * uvz , uuvz = qx * uvy - qy * uvx ; var w2 = qw * 2 ; uvx *= w2 ; uvy *= w2 ; uvz *= w2 ; uuvx *= 2 ; uuvy *= 2 ; uuvz *= 2 ; out [ 0 ] = x + uvx + uuvx ; out [ 1 ] = y + uvy + uuvy ; out [ 2 ] = z + uvz + uuvz ; return out ; }
Transforms the vec3 with a quat
 Can also be used for dual quaternions.
Transforms the vec3 with a quat Can also be used for dual quaternions .
// benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed // var qvec = [qx, qy, qz]; // var uv = vec3.cross([], qvec, a); // var uuv = vec3.cross([], qvec, uv); // vec3.scale(uv, uv, 2 * w); // vec3.scale(uuv, uuv, 2); // return vec3.add(out, a, vec3.add(out, uv, uuv));