[I've tried asking this question on math.stackexchange.com, but haven't got any responses, so I thought I'd try here] I’m building a model in a 3D simulation program (MSC Adams) and part of that model is a triangular platform which can translate and rotate in the virtual world, as shown in the 2 images below: There are some markers on this platform that, when it is at its home orientation, are aligned with the global axis system (which is the orientation of markers A, B and C in the first image). These markers move and orient with the platform so that they represent the platform’s orientation with respect to the global axis system. Now, I have a special marker (TOP_ORIGIN) that is coded so that it is always at the centroid of the corners of the triangle that form the platform (average of the coordinates A, B and C). What I’m trying to do is to also constrain the orientation of the marker as follows: The X-Y plane is the same as the platform’s plane with the Z axis putting “up” away from the model. The angle between the X axis and the vector XA is set to an angle, theta, which I calculate elsewhere. The software gives me two ways of getting and setting the orientation of objects: yaw-pitch-roll (rotation about Z then rotation about the new Y, then rotation about the new X) and phi-theta-psi (rotation about Z then rotation about the new X, then rotation about the new Z). How can I apply these transformations to get the marker to the orientation I want?