1. 程式人生 > >三個歐拉角得到3x3旋轉矩陣

三個歐拉角得到3x3旋轉矩陣

三維空間 ont pre sin cos rotation mic ati div

三維坐標系中,已知三個歐拉角alpha,beta,gamma,分別為繞x軸旋轉alpha角度,繞y軸旋轉beta角度,繞z軸旋轉gamma角度。則旋轉矩陣Rotation的求法如下:

Mat Rot=Mat::eye(3,3, CV_32FC1);

    Rot.at<float>(0, 0) = cos(beta) * cos(gamma);
    Rot.at<float>(0, 1) = cos(beta) * sin(gamma);
    Rot.at<float>(0, 2) = -sin(beta);
    Rot.at<float>(1
, 0) = sin(alpha) * sin(beta) * cos(gamma) - cos(alpha) * sin(gamma); Rot.at<float>(1, 1) = sin(alpha) * sin(beta) * sin(gamma) + cos(alpha) * cos(gamma); Rot.at<float>(1, 2) = sin(alpha) * cos(beta); Rot.at<float>(2, 0) = cos(alpha) * sin(beta) * cos(gamma) + sin(alpha) * sin(gamma); Rot.at
<float>(2, 1) = cos(alpha) * sin(beta) * sin(gamma) - sin(alpha) * cos(gamma); Rot.at<float>(2, 2) = cos(alpha) * cos(beta);

Rotation是3*3矩陣,用於三維空間坐標的旋轉。

三個歐拉角得到3x3旋轉矩陣