我用以下RotateTransform3D代码设置了我的C#:
rotation = new RotateTransform3D(
new AxisAngleRotation3D(new Vector3D(0, 0, 1),
Convert.ToDouble(5)),
new Point3D(0, 0, 0)
);我怎么把那个"5“拿回来的?如果我做了
MessageBox.Show(rotation.Rotation.toString())它说System.Windows.Media.Media3D.AxisAngleRotation3D,但是".Rotation“应该产生一个Rotation3D对象,就像MSDN说的那样。
我怎么能这么做?
编辑:其他信息
在我的代码中,我将该RotateTransform3D设置为Transform3DGroup中的子级,如下所示:
myGroupArray[0].Children.Add(
new RotateTransform3D(
new AxisAngleRotation3D(new Vector3D(0, 0, 1),
Convert.ToDouble(5)),
new Point3D(0, 0, 0)
)
);在另一个函数中,我试图用以下方法恢复"5“:
RotateTransform3D rotation = new RotateTransform3D();
rotation = (RotateTransform3D)myGroupArray[0].Children[0];现在,即使是做
MessageBox.Show(rotation.Rotation.Angle.ToString());由于Rotation3D不包含Angle属性而导致错误。
发布于 2013-03-26 00:39:37
它适用于
MessageBox.Show((rotation.Rotation as AxisAngleRotation3D).Angle.ToString());感谢iTateSLC (来自这里)的解决方案:D
https://stackoverflow.com/questions/15626661
复制相似问题