Matrix for rotation about an arbitrary axis

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
User avatar
BurakCanik
Posts: 250
Joined: February 8th, 2014, 9:16 pm
Location: Istanbul, Turkey

Matrix for rotation about an arbitrary axis

Post by BurakCanik » October 20th, 2014, 8:39 pm

Hi folks. I've been reading the book "Introduction to 3D Grame Programming with Directx 11" by Frank D. Luna. I couln't solve an excersize question from the book, so I thought maybe you guys could help.
The question is this :
Build a rotation matrix that rotates 30 degrees along the axis (1,1,1).

I'm attaching some photos, which show :
1st one : Solution of the problem.
2nd 3nd one : How the subject is explained on the book

I don't understand why they are not using (1,1,1) for (x,y,z) values in rotation matrix formula. Instead they are using ( (1/root of 3), (1/root of 3), (1/root of 3) ). Can someone explain ?

Thanks in advance dudebros.
Attachments
Rotation_Problem_Solution.png
Solution to the mentioned problem.
(174.02 KiB) Not downloaded yet
Rotation_Page2.png
Second page of rotation transformation's explanation.
(382.58 KiB) Not downloaded yet
Rotation_Page1.png
First page of rotation transformation's explanation.
(278.22 KiB) Not downloaded yet
If real is what you can feel, smell, taste and see, then 'real' is simply electrical signals interpreted by your brain" - Morpheus

User avatar
BurakCanik
Posts: 250
Joined: February 8th, 2014, 9:16 pm
Location: Istanbul, Turkey

Re: Matrix for rotation about an arbitrary axis

Post by BurakCanik » October 20th, 2014, 8:44 pm

I'm also uploading a photo of the formula of rotation matrix exclusively, so you guys can understand the problem easier.
Attachments
Rotation Matrix Formula.png
Rotation matrix formula.
(52.57 KiB) Not downloaded yet
If real is what you can feel, smell, taste and see, then 'real' is simply electrical signals interpreted by your brain" - Morpheus

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Matrix for rotation about an arbitrary axis

Post by albinopapa » October 21st, 2014, 1:17 am

it's so it's a unit vector, I'm guessing. Unit vector magnitude is 1. You get magnitude by squaring the components then taking the square root of their sums. So square(1 / sqrt(3) ) is 1/3. 1/3 + 1/3 + 1/3 = 1 and sqrt( 1 ) = 1.


Edit: http://www.cprogramming.com/tutorial/3d ... nions.html

This webpage is something I found while looking for some of my own answers. If you build the matrix with all axes (X, Y, Z) being 0 and the fourth ( W ) being 1 (0, 0, 0, 1), the resulting vector from multiplying the vector and matrix is the Identity Matrix

1, 0, 0, 0
0, 1, 0, 0
0, 0, 1, 0
0, 0, 0, 1

The rest of the page might be useful to you as well

Edit 2: Another helpful page that has finally helped me figure out the camera movement for 1st person view.
http://3dgep.com/understanding-the-view ... iew_Matrix
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

User avatar
BurakCanik
Posts: 250
Joined: February 8th, 2014, 9:16 pm
Location: Istanbul, Turkey

Re: Matrix for rotation about an arbitrary axis

Post by BurakCanik » October 22nd, 2014, 7:33 pm

OKAY I found out why.

http://en.wikipedia.org/wiki/Rotation_matrix

Scroll down to the title "Rotation matrix from axis and angle". You'll see the matrix I was talking about. And I quote, it is "the matrix for a rotation by an angle of θ about an axis in the direction of u". THAT'S WHY ( 1 / sqrt(3) ) IS USED INSTEAD OF 1. Components of the vector are normalized so that you get a vector which points in the direction of the vector (1,1,1) and has a magnitude of 1 units.

I'm so furious at Frank D. Luna right now. Why the hell would you not include this super simple and short sentence in your book ? I bet this stupid and simple shit was the reason my follicles felt like they were pulled by a thousand men during the day. That or I have some problems with my hair that I should really be worried about. Anyways I'm relieved now.

Also albinopapa thanks for those links. Even though quaternions are covered on the last third of the book I read it. A little info before I dive into the subject is something I really appreciated. Also I know where to look if I don't get it when I'm reading that chapter. Haven't got time to look at the second link you mentioned but it seems like a comprehensive tutorial about the view matrix. I'll certainly give it a look when I get there. Thanks!
If real is what you can feel, smell, taste and see, then 'real' is simply electrical signals interpreted by your brain" - Morpheus

User avatar
BurakCanik
Posts: 250
Joined: February 8th, 2014, 9:16 pm
Location: Istanbul, Turkey

Re: Matrix for rotation about an arbitrary axis

Post by BurakCanik » October 22nd, 2014, 7:38 pm

Though when I think about it, I should have deduced that if I have a formula in which I need to use a vector whose magnitude is 1 and I have a vector whose magnitude is not 1, the logical thing to do is normalizing it. So turns out I'm the one I should be furious at and who's as dumb as a rock. So yeah :D Good day everybody.
If real is what you can feel, smell, taste and see, then 'real' is simply electrical signals interpreted by your brain" - Morpheus

Post Reply