0

我很难找到正确的偏航、俯仰和滚动。我在随机平面上有 3 个盒子。

带框的图像

我想找到每个盒子的偏航、俯仰和滚动。我使用的公式是:

string _outOrientation = string.Empty;
Point3d _worldPointA = new Point3d(0.0, 0.0, 0.0);
Point3d _worldPointB = new Point3d(0.0, 0.0, 1.0);
Vector3d _worldZvector = _worldPointB - _worldPointA;

Plane _scenePlane = new Plane(_worldPointA, _worldZvector);
Plane _orientationPlane = _planeBase;

//here is a 4x4 tranformation matrix
Orientation _orientation = new Orientation(_scenePlane, _orientationPlane);

Transform _transform = _orientation.ToMatrix();
//ROLL 
double Aradian = Math.Atan2(_transform.M21, _transform.M22);
//PITCH 
double Bradian = -Math.Atan2(_transform.M20, Math.Sqrt(_transform.M21 * _transform.M21 + _transform.M22 * _transform.M22));
//YAW 
double Cradian = Math.Atan2(_transform.M10, _transform.M00);

//ROLL to degree
 double Adegree = RadianToDegree(Aradian);                                                                         
//PITCH to degree
 double Bdegree = RadianToDegree(Bradian);
//YAW to degree
double Cdegree = RadianToDegree(Cradian);

_outOrientation = string.Format("{0} {1} {2}", Adegree.ToString(), Bdegree.ToString(), Cdegree.ToString());

我的结果是这样的这个

4

0 回答 0