Solved

Rotation

Posted on 2001-06-26
7
450 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
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…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

948 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

19 Experts available now in Live!

Get 1:1 Help Now