Box rotation

Started by
3 comments, last by Ivan Mandic 14 years, 5 months ago
Hello. If I have a box ABCDEFGH[A(X,Y,Z),B(X,Y,Z)...H(X,Y,Z)] and I roteate it around XYZ axis,how can I calculate new coordinates of points ABCDEFGH? Thanks.
Advertisement
Transforming the box corners is really just like transforming any geometry (such as a mesh model). The most common way to do this is to construct a matrix representing the desired transform, and then apply it to each vertex (the box corners, in this case) in turn.

May I ask what you need the transformed corners for? (I ask because if it's for collision detection or frustum culling, you most likely don't actually need the transformed corners.)
Thanks for your reply. I want to add BoxInFrustum to NeHe's frustum culling: http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=44
Quote:Thanks for your reply. I want to add BoxInFrustum to NeHe's frustum culling: http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=44
You don't need to compute the transformed vertices of the box in order to perform frustum culling; for boxes (both oriented and axis-aligned), you can perform the box-plane test more directly by comparing the projected radius of the box to the distance from the box center to the plane.

More info here and here.
Thanks for your help :)

This topic is closed to new replies.

Advertisement