Eric_Pines

12-08-2003, 12:04 AM

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

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