var lastQuaternion = new THREE.Quaternion();

You will also have to add the dot product as a method of Quaternion.