Solved

Rotation

Posted on 2001-06-26
7
446 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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Artificial Intelligence comes in many forms, and for game developers, Path-Finding is an important ability for making an NPC (Non-Playable Character) maneuver through terrain.  A* is a particularly easy way to approach it.  I’ll start with the algor…
Recently, in one of the tech-blogs I usually read, I saw a post about the best-selling video games through history. The first place in the list is for the classic, extremely addictive Tetris. Well, a long time ago, in a galaxy far far away, I was…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

746 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now