vectorlinear-algebraquaternions

N-dimensional vector rotation


I am trying to generalize a class to handle vectors of any dimensions and type (float/int/double). Almost all common operations are straightforward to generalize for higher dimensions except for the rotation. Does extending vectors past 3-dimensional space also require me to extend quaternions?

Anyway, my code looked like this before:

public Vector3f rotate(@NotNull Quaternion rotation){
    Quaternion conjugate = rotation.conjugated();
    Quaternion w = rotation.mul(this).mul(conjugate);
    return new Vector<N>(w.getX(), w.getY(), w.getZ());
}

Can someone please help me, I've been at this for quite some time now. Thank you!


Solution

  • Aguilera-Perez Algorithm (http://wscg.zcu.cz/wscg2004/Papers_2004_Short/N29.pdf), as answered in the comments is the solution I was looking for.

    It's not as well optimized as well known formulas for 2D & 3D rotation so I ended up going with a split implementation at the time.

    Out of all resources I can currently find, this algorithm still seems the clearest and easiest to implement.