我有此代码段,可将我的模型向右旋转。
Point3D centre = GetCenter(model);
Vector3D axis = new Vector3D(0, 1, 0);
Matrix3D transformationMatrix = model.Content.Transform.Value;
transformationMatrix.RotateAt(new Quaternion(axis, 90), centre);
myTransform3DGroup.Children.Add(new MatrixTransform3D(transformationMatrix));
axis = new Vector3D(1, 0, 0);
transformationMatrix = model.Content.Transform.Value;
transformationMatrix.RotateAt(new Quaternion(axis, 150), centre);
myTransform3DGroup.Children.Add(new MatrixTransform3D(transformationMatrix));
当我添加以下代码时,我会得到
axis = new Vector3D(0, 0, 1);
transformationMatrix = model.Content.Transform.Value;
transformationMatrix.RotateAt(new Quaternion(axis, 90), centre);
myTransform3DGroup.Children.Add(new MatrixTransform3D(transformationMatrix));
如您所见,它并没有像我所希望的那样围绕z轴旋转。我是HelixToolkit的新手,但我要寻找的是将面朝前旋转,然后我计划编写一个函数,该函数将允许我给出3个角度,使我可以沿xy和z旋转面-轴。
我已经排除了一些代码,如果需要的话,请告诉我,我可以发布。
关于如何沿轴旋转的任何想法?