I’ve a problem with rotation. I’have objects whose center coordinates is not the origin (0,0,0) but I want them to rotate on themselves. So I calculate the center vertex of each object which gives me a new system coordinate for each object. Then I rotate them. Unfortunately some objects don’t rotate exactly around the center vertex. Could someone explain to me how I should proceed ?
Below is the code.
You are trying to achieve what is known as a composite tranformation.
Here is the idea to do it:
1)Translate the entire object to the origin so that the centre of the object and the origin coincide.
2)Rotate the object now.
3)Translate the object back to it’s original position by the required amount(negative of value specified in step 1).
You refer to either
Foley, van Dam, Feiner and Hughes’s book on Computer Graphics.OR
Hearn and Baker’s book for the same.
TOPIC:composite tranformation
Once you’ve done that, you could start generating your own tranformation matrices that combine the results of step 1,2 and 3.
Hi princeofflight,
So “composite transformation” is the key, hu ?
Thank you for the info, I’m gonna study this and probably buy he books
I’ve a lot to learn.