Transform Object Using Euler Angles

Hello All,

I have been writing a script where it will import a .txt file containing x,y,z,yaw,pitch,roll values at different positions (10-20 positions). This script I have will place the object at the correct x,y,z values but I am having trouble with the logic on the yaw,pitch,and roll rotations.

My first attempt at solving this was to apply 3 separate rotations of 10 degrees relative to the objects coordinate system. I have a script which determines the axes of rotation after each rotation, but I quickly realized that rotating an object to obtain a yaw, pitch, and roll of 10 degrees is not simply rotating that object 3 times at 10 degrees.

I am wanting to apply the Euler rotation in the X-Y-Z order, but I am unsure of how to calculate the angles for each rotation to obtain the known yaw, pitch, roll. I know this is commonly done for robotics. Does anyone have any recommendation on where to start?

Regards,
Martin

I also want to mention that the Yaw is measured relative to the world axis, where Roll and Pitch are relative to the object.

Convert Euler/Tait-Bryan angles to a quaternion, see https://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles#Euler_Angles_to_Quaternion_Conversion

Then use vector rotation (see same page). This is also provided by RhinoCommon, which has a Quaternion structure, see https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_Quaternion_Rotate.htm