# A simple question about rotation

 12 December 2003 Eric_Pines New Member A simple question about rotation Greetings. I'm hoping someone could help out a newbie with a simple question. If I have a euler axis that uses coordinates with Y as Up/Down and Z as Depth, but need to convert it to a coordinate system that has Z as up down and Y inversed as depth? How do I do this? Anything would be a great help, even just the proper term for what the above tries to do, so I can better search for the answer with Google. Thanks PS - Can someone see something wrong with this function used to add euler rotations? To me it does not work the way I think it does. (I have to reverse the original rotation be the value to rotate by when I call it.) Function Add_Rotation(orig As VertexData, rotateBy As VertexData) As VertexData Dim rotated As VertexData rotated.vX = orig.vX rotated.vY = Cos(rotateBy.vX) * orig.vY - Sin(rotateBy.vX) * orig.vZ rotated.vZ = Sin(rotateBy.vX) * orig.vY + Cos(rotateBy.vX) * orig.vZ rotated.vX = Cos(rotateBy.vY) * rotated.vX - Sin(rotateBy.vY) * rotated.vY rotated.vY = Sin(rotateBy.vY) * rotated.vX + Cos(rotateBy.vY) * rotated.vY rotated.vZ = rotated.vZ rotated.vX = Cos(rotateBy.vZ) * rotated.vX - Sin(rotateBy.vZ) * rotated.vZ rotated.vY = rotated.vY rotated.vZ = Sin(rotateBy.vZ) * rotated.vX + Cos(rotateBy.vZ) * rotated.vZ Add_Rotation.vX = rotated.vX Add_Rotation.vY = rotated.vY Add_Rotation.vZ = rotated.vZ End Function share quote
 12 December 2003 geosync New Member Andy Hawkins 3d Graphic Artists & Programmer Australia If you are programming in Direct8.1 research the D3DX helper code as it deals with Euler angles (and Quaternions too). Andy H. share quote
 12 December 2003 dead_eye Pika pika!   Steven Emory Teaching Associate Los Angeles, USA Re: A simple question about rotation Quote: Originally posted by Eric_Pines If I have a euler axis that uses coordinates with Y as Up/Down and Z as Depth, but need to convert it to a coordinate system that has Z as up down and Y inversed as depth? How do I do this? Anything would be a great help, even just the proper term for what the above tries to do, so I can better search for the answer with Google. Thanks Multiple all points by this matrix: [ 1 0 0 0 ] [ 0 0 1 0 ] [ 0 1 0 0 ] [ 0 0 0 1 ] What it does is it's an orthogonal matrix, that maps points on the y-axis to the z-axis, and points on the z-axis to the y-axis. It's the same thing that you'd get if you'd do a rotation matrix about the x-axis for 90 degrees. Also, for euler angles (heading, pitch, and banking angles), what they normally do is convert them to quaternions, and then convert them to rotation matrices. It's all in the book, Real-Time Rendering, by Tomas Moller, be sure to pick a copy up. __________________ Steven Last edited by dead_eye : 12 December 2003 at 08:14 AM. share quote
 01 January 2006 CGTalk Moderation Expert Thread automatically closed This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum. __________________ CGTalk Policy/Legalities Note that as CGTalk Members, you agree to the terms and conditions of using this website. share quote

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts vB code is On Smilies are On [IMG] code is On HTML code is Off CGSociety Society of Digital Artists www.cgsociety.org Powered by vBulletinCopyright ©2000 - 2006, Jelsoft Enterprises Ltd.