%This function is for internal use only. It may be removed in the future.

%rotChildToParent Compute matrix defining rotation from child's coordinate
%frame into parent's coordinate frame.
%   R = driving.internal.rotChildToParent(ROLL,PITCH,YAW) returns the
%   matrix defining the rotation required to transform a set of points from
%   the child's coordinate frame into the parent's coordinate frame, where
%   the child's coordinate frame is offset from the parent's frame by the 3
%   Euler angles: ROLL, PITCH, and YAW. All angles are defined as scalars
%   in degrees.
%
%   Notes
%   -----
%   - Roll, pitch and yaw use an ISO convention, with clockwise positive
%     angle directions when looking in the positive direction of Z, Y and
%     X-axis of the parent's coordinate frame respectively.
%
%   % Example:
%   %   Rotate the point (0,1,0) back into the parent's coordinate frame.
%   %   The child's frame is defined relative to the parent with an offset
%   %   of (5,0,10) from the parent's origin and rotations of:
%   %
%   %       Roll:    5 degrees
%   %       Pitch:  15 degrees
%   %       Yaw:   -20 degrees
%
%   xChild = [0 1 0]';
%   T = [5,0,10]'; Offset of child's origin from parent's origin
%   roll = 5;
%   pitch = 15;
%   yaw = -20;
%   R = driving.internal.rotChildToParent(roll,pitch,yaw);
%   xParent = R*xChild+T;

%   Copyright 2016-2020 The MathWorks, Inc.

% internal function, no error checking is performed

%#codegen 

function R = rotChildToParent(roll,pitch,yaw)
R = (driving.scenario.internal.rotZ(yaw)* ...
    driving.scenario.internal.rotY(pitch)* ...
    driving.scenario.internal.rotX(roll));
end
