Solved

Rotation

Posted on 2001-06-26
7
490 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Get Database Help Now w/ Support & Database Audit

Keeping your database environment tuned, optimized and high-performance is key to achieving business goals. If your database goes down, so does your business. Percona experts have a long history of helping enterprises ensure their databases are running smoothly.

Question has a verified solution.

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

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…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

632 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