As Nathan Reed and teodron exposed, the recipe for rotating a vector v by a unit-length quaternion q is:

1) Create a pure quaternion p out of v. This simply means adding a fourth coordinate of 0:



2) Pre-multiply it with q and post-multiply it with the conjugate q*:



3) This will result in another pure quaternion which can be turned back to a vector:



This vector v' is v rotated by q.



This is working but far from optimal. Quaternion multiplications mean tons and tons of operations. I was curious about various implementations such as this one, and decided to find from where those came. Here are my findings.

We can also describe q as the combination of a 3-dimensional vector u and a scalar s:



By the rules of quaternion multiplication, and as the conjugate of a unit length quaternion is simply it's inverse, we get:



The scalar part (ellipses) results in zero, as detailed here. What's interesting is the vector part, AKA our rotated vector v'. It can be simplified using some basic vector identities:



This is now much more optimal; two dot products, a cross product and a few extras: around half the operations. Which would give something like that in source code (assuming some generic vector math library):

void rotate_vector_by_quaternion(const Vector3&amp; v, const Quaternion&amp; q, Vector3&amp; vprime)
{
    // Extract the vector part of the quaternion
    Vector3 u(q.x, q.y, q.z);

    // Extract the scalar part of the quaternion
    float s = q.w;

    // Do the math
    vprime = 2.0f * dot(u, v) * u
          + (s*s - dot(u, u)) * v
          + 2.0f * s * cross(u, v);
}


Rotating vector3 by a quaternion
VMWare has a feature when creating new VMs called Easy Install, that will show you a small wizard asking you the minimum things needed and then will install the entire OS without you needing to do anything.

When installing Ubuntu server, it only asks you the details of the default user (Full name, username, password and repeat password) and then installs ubuntu with the default options and packages.

I'd like to know if I can tell it to install some extra packages, run custom commands before finishing the installation or using another apt repository than the default one.

BTW if it matters, I'm using VMware Player 5.0.0 on Ubuntu 11.10 amd64, and I'm planning to install Ubuntu 11.10 amd64 server as a guest.
