Solved

Rotation

Posted on 2001-06-26
7
470 Views
Last Modified: 2013-12-26
When we rotate an object about an axiz parallel to co-ordinate axis the original co-ordinates of object changes slightly (where they should not) . How we can solve this problem.
0
Comment
Question by:Sana060101
7 Comments
 
LVL 2

Expert Comment

by:smitty1276
ID: 6230221
That is a confusing question.  When you rotate an object its coordinates are going to change.  So I don't understand what you mean by that.

Also, what do you mean by "an axiz parallel to co-ordinate axis"?
0
 

Author Comment

by:Sana060101
ID: 6233807
for example I rotate a rectangle about itself (about an axis parallel to x-axis)by 360 degrees. That means original rectangle should be restored. But this does not happen. What procedure I have adopted is to translate the rectangle so its centre on x-axis and then rotate it and translate it back. I generated a composite matrix and transformed the triangle.
0
 
LVL 4

Accepted Solution

by:
joachimc earned 30 total points
ID: 6237329
Hmm what you do is to rotate the rectangle around it's own axis then you translate it to the coordinate you want.

The example is in VB but since it's D3DX it's the same except for syntax quirks.

'Rotate
D3DXMatrixRotationX myMatX, -0.05 'Rotate
'Multiplay with the view
D3DXMatrixMultiply ourMatView, myMatX, ourMatView
'Do the transformation
ourD3DDevice.SetTransform D3DTS_VIEW, ourMatView

/Joachim
0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 

Expert Comment

by:Toyemann
ID: 6242873
Sana, ideally, your concept should work, but in reality, whenever you deal with a decimal value (such as PI and division), it's rare it'll ever return to the original value.

Unless, you're rotating in all three directions, I usually apply my rotation from my origin.  And whenever the angle crosses 360 degree, I just minus or mod the value by 360.  Whenever you add onto a existing value, you're bound to run into some offset value.
0
 

Author Comment

by:Sana060101
ID: 6258270
Joachim
I have tried to rotate the view matrice but things disappear from the screen. What can be problem.
0
 

Expert Comment

by:GuyJohnston
ID: 6278835
I also had this problem.
To solve this problem, I made an
array of cos, sin tables. I then
kept a copy of the untransformed shape
and calculated the rotation to a transformed
shape. When I changed theta, the rotation
of the shape changed. But the rotations where
kept constant because I used the untransformed
shape with the cos, sin tables. This eleminated
the decimal error you normally experience.
This is not however, an inefficient method. Your
rotations are limited to your tables, and there is
extra memory overhead for your shape. There is probably
something better out there.

 

 

 
0
 
LVL 4

Expert Comment

by:joachimc
ID: 6307360
Can't see a problem with my code. The thing you can do is to multiply in the wrong order. That gives very strange effects since A * B != B * A with matrices.

/Joachim
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
DirectXFramework 5 113
"Access Denied" when try to modify Google Earth Flight Sim F-16 parameter file 3 1,201
RTS dev - where can I get scenery tiles? 1 279
bunnyEars2 challenge 6 148
What is RenderMan: RenderMan is a not any particular piece of software. RenderMan is an industry standard, defining set of rules that any rendering software should use, to be RenderMan-compliant. Pixar's RenderMan is a flagship implementation of …
As game developers, we quickly learn that Artificial Intelligence (AI) doesn’t need to be so tough.  To reference Space Ghost: “Moltar, I have a giant brain that is able to reduce any complex machine into a simple yes or no answer. (http://www.youtu…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question