result2 should then be the rotated vector, but it does not work. i dont know how to explicitely write down the rotation specification in this topic, i hope you can help me!
you were multiplying component by component.
Suppose that v1.Y = 0, then in the result would be 0 too, regardless of how the rotation is made; which is clearly wrong.
> the problem is that, after the rotation of the to-be-rotated- vector, the real part does not stay zero
`makeInverse()' modifies the calling object
If optimum performance is not required (and you're project does not require the math), I would separate this into pieces:
Rotate x, rotate y, and rotate z. You can create a function to rotate a function to rotate each axis,and then all you have to do is rotate the 3D array one axis at a time accordingly.
Of course, this approach would be cpu-intensive, and if you're doing this for class, you're professor may not want you to do this.
well, i am not sure if performance issues could appear later on. i am doing this for a gran-canonical monte-carlo simulation so i think it should be better to make a fast rotation of my "molecules" in the simulation.
also, i thought that rotations via quaternions are kinda easy to implement if you started understand it once.
what i don't understand is the calculation:
v' -> q*v*q^(compl. conj.)
q is a quaternion, and the real part of this quaternion includes the information of the rotation angle, while the imaginary parts i,j,k define the rotation axis.
is this correct?
so if your vector is 3-dimensional, like v=(x,y,z); and the quaternion is 4-dimensional: q= (X,Y,Z,W) this multiplication makes no sense. all i could do is write the 3d-vector as v=(x,y,z,0) but then i get nonzero entries in the 4th dimension, which is what i want to avoid, of course.
i did not really find a good example how this calculation is ment to be done in practise, if you know it i would be very happy if you could give me an example.
> but then i get nonzero entries in the 4th dimension, which is what i want to avoid, of course.
your code was wrong. `a2' an `a1' were the same quaternion.