05a 3D CS Bsc Rotations as two Reflections using Quaternions

Channel: IGG-UniBonn Published: 2020-12-13 3,690 words Source: auto_caption
Advanced Mathematics & Geometric Physics

Transcript

yeah ladies and gentlemen welcome to this lecture on 3d coordinate systems this time it's a lecture which is outside the regular curriculum of our students but it might be interesting it is about rotations using quaternions and we will show that rotations can be represented as two reflections and we can easily derive the rotations based on this idea the problem is and this is the motivation behind this lecture is that in the previous lectures i proved the form of the rotation matrix so i gave it and then we made a proof for the axis angle representation and the same for the quaternion representation what this lecture is about that we construct both using geometric insight on one side and using basic rules of quaternions the idea for this constructive way to generate rotations is going back to corksetter uh one of the biggest geometries in last century he published a paper in 1946 on quaternions and reflections which i recommend you to have a look at it so let's have a look at the situation let's assume we have a point here and we have a reflecting plane here so this point is reflected to this point now we have a second plane here or in 2d align and then we have a reflection which moves this point to here now we see that if we change the two lines simultaneously and leave the angle constant this point stays where it is so it doesn't matter where these reflecting lines or planes are as long as the angle is fixed now if we change the angle we can do this we find out that the rotation changes and of course with the change angle we have the same result as before here and what you now see is that if we go back we see that we have here an angle of 46 degrees between the planes and we have here an angle of 92 degrees between p and p double prime that means if we perform a reflection at two lines where the normals have an angle of alpha the rotation from here to here has the angle two alpha now let's go to two to 3d let's assume we have planes here we get of course the same situation as before we have here a 3d object with four points it's reflected here at this plane at this mirror and a second time at this mirror arriving at this place now you see that it's really a rotation from the green or yellow part to this red part and again of course we have the same with the angles that the angle between these two planes doubled yields the angle between this and this point why because this angle is the same as this one and this angle is the same as this one so we get the double angle rotation the interesting thing is now that because if we change the planes simultaneously it doesn't matter it has not it would not change this 3d object that means only the angle between these two planes is of relevance that's the first part the second part is that we actually perform a rotation around the intersecting line of these two planes so you have two planes and we have the intersecting line and we rotate around this intersecting line how can we calculate the direction of this line we have the normal the light blue one and the red one and we take the cross product of these two which is a line pointing towards us outside of the screen that means have we have a positive rotation around the first normal um and about a cross product the second normal so this is the geometric inside and now we want to formalize this using quaternions this is just summarizing what we just observed we have a 2d a rotation angle theta which is double the angle which is the angle between the lines the angle between the lines may be restricted so if we rotate i go back to the first rotation let's assume we rotate this here we have the angle we can restrict this to plus minus 90 degrees let's say from here to here so this would be easy so because then we have actually a rotation by 180 degrees and jointly rotating the lines doesn't change the rotation in 3d we have the sim situation similar we have the angle alpha between the planes and the rotation angle is two times we have the angle between the lines may be restricted and the rotation axis is intersection line of the planes and if we jointly rotate the two mirroring planes the rotation doesn't change okay i make a little bit repetition of how we represent quaternions in this context we use quaternions as pairs of a scalar and a vector and we remember that the addition is just adding the two parts and the product of the quaternions is this product of the two's color parts minus this color products of the two vector parts then we have the weighted sum of the vector parts and the cross product we need the notion of a conjugation which means that the conjugate quaternary is nothing else than this color part and the negative vector part and the norm of a quaternion is nothing else than the sum of this squared scalar part and the length of the vector part squared and there's an inverse which is related to the conjugation which is nothing else than the conjugate quaternions divided by the norm squared so this is what we have how we what we learned in the previous lecture and we have special quaternions we have the one quaternion which we could write as an upright one or one zero or just as a one that means it has if we multiply it it has no effect then we have unit quaternions where the length of the quadratus is one that means the sum of the squares of all elements is one and which is very important in our context is what we is called pure quaternions they only have a vector part the scalar part is zero this is um very useful if we have 3d points we just put the 3d coordinates into the vector part and we have a zero in the scalar part now the what we want to do is the following we want to derive the formula for reflection so we have p reflected at this plane with the normal n to get p prime and we will see that we can write this reflection as the quaternion product of n multiplied with p multiplied with n and if we do the same thing a second time we get the second twice the reflected point p double prime um as q multiplied with the given p multiplied with q dual quadrate where q is the negative of the product of the two normals this is what we want to derive so that's so to say the program so in order to fulfill this we need to need the rules for pure quaternary so all the quaternions on this slide are pure quaternions the given ones the x and y or z and we see the following if we have the product of two pure quaternions we have no scalar part here and we don't have the weighted sum of the products so we have here the negative scatter product and here the cross product if we take the square of two quaternions that means we multiply a quaternary with itself x and y are the same so we get here the negative norm squared of x and the cross product of x and y is zero so we have a a real number minus the square of the norm if we take the cube we just multiply with x once more we get minus this norm square multiplied with x now if we take the product of conjugates so what happens so we have x with negative vector part y with negative vector part so the scalar paths are anyway zero the dot product doesn't change because both vectors change their sign and the same happens with x and y so we actually get x multiplied with y if we reverse the product then what happens the scalar product doesn't change but the cross product changes its sign so we actually get the conjugate of x multiplied with y now if we have two orthogonal quaternions that means the two vector parts are perpendicular what happens so let's assume we have two pure quaternions x and z then they are orthogonal that means x dot zero so this is zero and then we have x cross y is of course the negative of y cross x that means in this case x cross c is minus z cross x so if we add the two products the products xz and the reverse product we get zero because the scanner part is zero and the cross products cancel now we can specialize to unit quaternions that means unit pure quaternions that means the vector part is normalized to length one and if we take this cube as a square we get x square is negative of the norm the norm is one so we get minus one that means unit pure quaternions are square roots of minus one which is interesting and of course if we take the third power we just have to multiply with x so we the taking the third power is leading to the negative vector x and finally we take the product of two unit quaternions with angle alpha then if x and y are units then here we get minus the cosine of the angle and here we get the cross product which has length the sine of the angle and has the direction of the cross product so this is a direction vector now the n means normalization and of course because cosine plus sine square is one and this is length one the length of this product of two unit quaternions is again a unit quaternion so we use these relations which are quite simple to see in the following so let's start we want to look how a reflection at a plane could look like we represent points as pure quaternions so we have the point with coordinates x y z put them into this vector and generate a pure quaternion let's say this point here then we have a plane through the origin with a normalized normal that means here this vector n is a unit vector in this direction perpendicular to that plane and we represent it with zero n that means again as a pure quaternion but it has length one so it's a pure unit quaternion and the task is now to determine the reflected point how can we do this okay let's assume we have a point on this reflection plane this is an arbitrary point f and we know that these two vectors f and n are perpendicular so we have orthogonal quaternions and this is exactly the condition so the product of fn plus the product of nf is 0. so this was this rule here for the product of orthogonal quaternions now we can use the constraint for the unit quaternion which is n square equals -1 and multiply this equation from right or left with n now what happens we get if you multiply from the right with n we get here f n squared which is minus f plus n f n which is plus n of n and if we put that on the other side we get actually a constraint f equals n multiplied with f with n so it's just rewriting this constraint for the special case that n is a unit quadrant now this is a constraint between n and f that they are orthogonal but we also could say this is a mapping from f to the product nfn so we have a mapping from some point f onto some point nfn and obviously this means that this point f is mapped to itself so you see the point f is mapped to itself so of the if we take this mapping multiplying with from left and right with the same unit quaternion we get a fixed points on this plane which is normal to this normal vector now we take a point g on the line of the normal so we have a point here which is sun mu times the direction of the normal which is a pure quaternion and we see that this maps to the opposite point why is that so so we take the mu n which is our g it maps to n multiplied with mu n multiplied with n we can put this color on the other side we get mu times this cube of n and this is actually minus n that means we get minus mu n which is minus g so a point on a line along the normal is mapped to the reflected point with respect to this plane and now we take an arbitrary point p and decompose it in two parts one is in the direction of the plane and one is in the direction of the normal and that means the point p is mapped to f minus g that means this mapping p multiplied from left and right with the same unit pure quaternion is a reflection at the plane perpendicular to this normal vector n so what we have achieved is a mathematical description of the reflection now let's perform two reflections the first reflections which we discussed so from p to p prime with this reflected plane and we have here the normal of that plane and the second reflection at a different plane let's say this one with this normal is nothing else than m multiplied with p prime multiplied with m or m n which is the first part p and then m n m in the reverse order and what we know from geometric insight is that what stands here is a rotation from p to p double prime so this is the representation that what we remember is that the description is not unique because we could choose the two planes differently now let's have a look we can rewrite this rotation from p to p double prime by observing that we have here m n and here the reverse product so it only depends on the product of these two okay we take the product of these two choose a negative sign why because we then obtain a quaternion which is the scalar product of n and m not the negative scalar product and the cross product of n cross m and we remember that if we take the conjugate of m n we get the product of n and m so this n m is nothing else than the conjugate of m multiplied with n aha that means the essential part is this quaternion it's the angle between these two values and the cross product of these two vectors that means what we obtain is that this quaternion is nothing else than cosine alpha that's the angle between n and m and sine alpha which is the sine of the angle between the two normals multiplied with the direction of the normal ah this comes to something which we could expect so generally we obtain a rotation with a unit quaternion from p now to p prime around this rotation axis pointing out of the screen with angle theta is the multiplication of some point p from the left with q and from the right with the conjugate of q assuming that q is a unit quaternion so this is a important result that the rotation can be represented with a unit quaternion so in both cases we assume that p and p prime are pure quaternions and now from the geometric inside we remember that the rotation angle theta is two times the angle between the two planes so we actually instead of having this quaternion we could also say it's the cosine of half the rotation angle for the scalar part and sine of the half angle between of the rotation multiplied with the direction vector of the rotation r is a unit vector so this is a very important result because it now allows to interpret this quaternion in terms of the rotation properties we have the axis r and the angle theta and we can directly generate the q now if we have it with a unit quaternion we have this expression just derived now if the quarter the quadrant has general length arbitrary length then we have to multiply from the left with q and from the right with q power minus 1 why because we have here q prime a q bar which is the conjugate and because we have here the length and here the length once more we have to divide by the length of the quaternion squared that means a rotation represented with an arbitrary quaternion can be is the same as the rotation derived by some quaternion multiplied with an arbitrary factor lambda this could be either make a unit quaternion out of it or we could take the negative value so the rotation with q and the rotation with minus q is the same rotation so in terms of homogeneous coordinates if we interpret q as a four a two element we can multiply this element with an arbitrary factor not zero and still get the same rotation so if we integrate quaternions as representing rotations they are homogeneous entities so what we of course have seen is that if we perform the rotation of some point p to p prime with the quaternion q in classical algebra we would write it as p multiplied with the rotation matrix depending on q gives our rotated point now how does this rotation matrix depending on q look like so we have here the point p multiplied from the left with q and the right from the right with q conjugate we assume the q is unit quaternion which is nothing else than the product the triple product of this quaternion with this quaternion with this quaternion so we see here the original quaternion here the conjugate and hear the pure quaternion of the point and after some steps we arrive at the following result you can have the look at these equations which is quite transparent we get a zero for the scalar part of the transform point and some matrix multiplied with p aha this is exactly what we want so the rotated point is a represented as a pure quaternion and the vector part is this matrix multiplied with p so this is exactly the rotation matrix which is caused by this unit quaternion so we can write this down of course for general quaternions so we take i plus two scalar parts multiplied with a skew symmetric matrix of the vector part plus 2 times the square of the skew symmetrics of the vector part and normalize with the square of the norm we can also rewrite it in this form and if you then say q0 is q and the vector is has elements q123 we arrive at this expression which we derived in the previous lecture uh before so this is actually a rotation matrix and has only quadratic elements so only squares are product of two elements so this is the rotation matrix if you have a unit quaternion and now we remember that q is the cosine of the half rotation angle and the rotation vector multiplied with sine half the angle is the vector part of this quaternion now we use these classical relations from trigonometry this is actually the form for double the angle so we have here the single angle theta half and here's a double angle that means theta and the same here for sine and now we see that is the unit matrix we have here 2 times q q was the cosine and this one this has the length sine so it's 2 cosine sine so it's sine theta which is here and here we have two times the sine square which is this one that means we arrive at one minus cosine theta and this is the classical axis angle form of a rotation matrix so given the rotation vector the direction vector and the angle we have here a explicit expression for the rotation matrix derived from our derivation with quaternions so as a conclusion what we did was to look at rotations at double reflections the reflection with pure quaternions can be written as the product of some point with the same pure normalized quaternion from left and right and the rotation as a consequence is this point multiplied from left with q and from the right with the conjugate we could normalize it and of course if we would have a mirror ring we just would have a mapping with a negative sign that means we reflect at the origin and the unit quaternion with axis r and angle theta is what we have seen the cosine of the half angle and we know now why there is half the angle because it's the angle between the two mirroring planes which is the causing fact for the rotation and what we derived was the x axis angle representation for the rotation and all this done was by construction so we didn't make any proofs before but we just used the basic rules from quaternions to construct this result again i referred to this paper from coxsetter thank you very much for listening