I am currently trying to find an equivalent for the following equation:

```
vec_res = inverse(VM) * (q * (VM * vec_input) * conjugate(q))

```

where *VM* is a standard view matrix , *q* is a normalized quaternion, and *vec\_input* a vector. 

In the form:

```
vec_res = A * vec_input;

```

or

```
vec_res = q' * vec_input * conjugate(q');

```

From <https://molecularmusings.wordpress.com/2013/05/24/a-faster-quaternion-vector-multiplication/> I am already calculating

```
vec_res = inverse(VM) * q * VM * vec_input * conjugate(q)

```

as 

```
pN = (VM * vec_input);
vec3 tempVec = 2.0 * cross(q.xyz, pN);
pN = pN + q.w * tempVec + cross(q.xyz, tempVec);
pN = inverse(VM) * pN;

```

My question is, do I have the right to rewrite the equation like this ?

```
vec_res = (inverse(VM) * conversion_to_matrix(q) * VM) * vec_input

```

Where conversion\_to\_matrix is the rotation matrix calculated as explained in: <http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToMatrix/>

If no, what is the math to be used behind ?