Latest LQ Deal: Linux Power User Bundle
 Home Forums HCL Reviews Tutorials Articles Register Search Today's Posts Mark Forums Read
 LinuxQuestions.org Matrix Rotation
 Programming This forum is for all programming questions. The question does not have to be directly related to Linux and any language is fair game.

Notices

 06-09-2008, 08:00 AM #1 disruptive Member   Registered: Dec 2005 Posts: 76 Rep: Matrix Rotation Hi, I am looking for a code that will perform a matrix rotation around a desired point and NOT about an axis for example. I am looking for references in this area that would help me achieve this rotation. I know it is possible, but cannot find anything relevant in the literature. Thanks
 06-09-2008, 10:29 AM #2 ischi Member   Registered: Apr 2008 Location: Tübingen Distribution: Fedora 9 (Thinkpad T60), Debian 3.1 (Server) Posts: 51 Rep: Well this is a simple Matrix multiplication, you take the standart rotation matrix with the disired Angle and multiply it with the given Matrix. Stuff like that can be found for example in OpenGL guides, or graphic programming guides which also show stuff like the bresenham algorithms, and such. Just Google for Bresenham and you'll going to find a couple of those, which might also keep on going towards more graphic stuff. Literature wise check out the OpenGL Redbook. Even though those kind of Manipulations are already implemented in OpenGL, it will show you how to use those. Which is your disired Programming Language? I did this kind of stuff using C++/QT/OpenGL in a course at my college.
07-21-2008, 11:47 AM   #3
disruptive
Member

Registered: Dec 2005
Posts: 76

Original Poster
Rep:
Quote:
 Originally Posted by ischi Well this is a simple Matrix multiplication, you take the standart rotation matrix with the disired Angle and multiply it with the given Matrix. Stuff like that can be found for example in OpenGL guides, or graphic programming guides which also show stuff like the bresenham algorithms, and such. Just Google for Bresenham and you'll going to find a couple of those, which might also keep on going towards more graphic stuff. Literature wise check out the OpenGL Redbook. Even though those kind of Manipulations are already implemented in OpenGL, it will show you how to use those. Which is your disired Programming Language? I did this kind of stuff using C++/QT/OpenGL in a course at my college.
I have some code that I have inherited which performs a 3D rotation by taking a central point a COM if you like and then determining a vector which defines a point in the system, an atom for example. Then this vector is simply rotated by theta and phi, using matrix rotations. I have the code, but I wish to have a reference to where the code came from and how it was derived.

 07-21-2008, 01:13 PM #4 jiml8 Senior Member   Registered: Sep 2003 Posts: 3,171 Rep: rotations always occur around an axis. The concept of rotation around a single point is invalid, except insofar as that point lies on the axis of rotation.
 07-21-2008, 02:33 PM #5 disruptive Member   Registered: Dec 2005 Posts: 76 Original Poster Rep: There are two components: One is a rotation about phi, which is with respect to an axis and this simply takes the form: | cos (phi) -sin (phi) 0 | | sin (phi) cos (phi) 0 | | 0 0 1 | That I agree is rotation about a z axis. Then there is the theta part which is much more complex. This I have broken down into some of the constituent parts. I cannot find anywhere on the wen where this might have come from. The summation of A, B and C leads to a rotation about theta, assuming some arbitrary axis, which one can assume is that same as before. A == | sin^2(theta)*(1-cos(theta)) (1-cos(theta))cos(theta)sin(theta) 0 | | -sin(theta)cos(theta)*(1-cos(theta)) cos^2(1-cos(theta)) 0 | | 0 0 0 | B == | 0 0 -cos(theta)*sin(theta) | | 0 0 sin^2(theta) | | cos(theta)sin(theta) sin^2(theta) 0 | C == | cos(theta) 0 0 | | 0 cos(theta) 0 | | 0 0 cos(theta) |

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is Off HTML code is Off Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post johnpaulodonnell Programming 4 04-30-2008 02:45 PM mdkusr Linux - Hardware 1 01-12-2006 02:57 PM Crashed_Again Linux - Software 0 02-09-2005 03:31 PM RedRaven Fedora 2 01-05-2005 10:20 AM The_Nerd Programming 3 09-03-2004 03:11 PM

LinuxQuestions.org

All times are GMT -5. The time now is 03:27 PM.

 Contact Us - Advertising Info - Rules - LQ Merchandise - Donations - Contributing Member - LQ Sitemap -