LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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


Reply
  Search this Thread
Old 06-09-2008, 07:00 AM   #1
disruptive
Member
 
Registered: Dec 2005
Posts: 76

Rep: Reputation: 15
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
 
Old 06-09-2008, 09:29 AM   #2
ischi
Member
 
Registered: Apr 2008
Location: Tübingen
Distribution: Fedora 9 (Thinkpad T60), Debian 3.1 (Server)
Posts: 51

Rep: Reputation: 15
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.
 
Old 07-21-2008, 10:47 AM   #3
disruptive
Member
 
Registered: Dec 2005
Posts: 76

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by ischi View Post
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.
 
Old 07-21-2008, 12:13 PM   #4
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
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.
 
Old 07-21-2008, 01:33 PM   #5
disruptive
Member
 
Registered: Dec 2005
Posts: 76

Original Poster
Rep: Reputation: 15
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) |
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
awk convert column matrix to square matrix? johnpaulodonnell Programming 4 04-30-2008 01:45 PM
Monitor rotation mdkusr Linux - Hardware 1 01-12-2006 01:57 PM
Metalog Rotation Crashed_Again Linux - Software 0 02-09-2005 02:31 PM
wallpaper rotation RedRaven Fedora 2 01-05-2005 09:20 AM
OpenGL texture matrix rotation The_Nerd Programming 3 09-03-2004 02:11 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration