3d立方体的运动上下轴旋转 [英] Movement of 3d cube Up and down axis with rotation

查看:106
本文介绍了3d立方体的运动上下轴旋转的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我有一个带有x / y / z向量的9向量MPU(运动传感器单元)加速度计,陀螺仪和磁力计。这个mpu输出通过USB连接输入到Windows,但我也可以通过无线连接。来自这9个向量的原始数据我输入到输出四元数的Madgwick / Mahoney
SensorFusion函数(在Windows中)。然后我使用这个Quaternion(我将其命名为qRotate)作为RotateTransform3D.Rotation对象的输入,如下面XAML中所示。

I have a 9 vector MPU (motion sensor unit) with x/y/z vectors from an accelerometer, gyro, and magnetometer. This mpu output is input to Windows via a USB connection, but I could also do it via Wireless. The raw data from these 9 vectors I input into a Madgwick/Mahoney SensorFusion function (in Windows) which outputs a Quaternion. I then use this Quaternion ( I named it qRotate) as input for the RotateTransform3D.Rotation object as seen below in XAML.

< GeometryModel3D.Transform>

     < RotateTransform3D>

             < RotateTransform3D.Rotation>&
                     < QuaternionRotation3D x:Name =" qRotate" />

                < /RotateTransform3D.Rotation>

      < / RotateTransform3D>

 < / GeometryModel3D .Transform>

<GeometryModel3D.Transform>
     <RotateTransform3D>
             <RotateTransform3D.Rotation>
                    <QuaternionRotation3D x:Name="qRotate"/>
               </RotateTransform3D.Rotation>
      </RotateTransform3D>
 </GeometryModel3D.Transform>

所以一切都在旋转 - 当我移动MPU时,立方体围绕所有轴旋转。但是,我不能让立方体在X轴,Y轴或Z轴上向上或向下移动。我怀疑这是因为OffsetX,
OffsetY或OffsetZ属性没有TranslateTransform3D输入。我在正确的道路上吗?如果是这样,我如何从原始9向量输入或四元数中获取偏移属性?任何人都有一些代码可以做到这一点?

So everything works rotationally - the cube rotates about all axis as I move the MPU about. However, I cannot get the cube to move up or down the axis either the X, Y, or Z axis. I suspect this is because there is no TranslateTransform3D input for the OffsetX, OffsetY, or OffsetZ properties. Am I on the right path here? If so, how do I get the Offset properties from the raw 9 vectors input or the quaternion? Anyone have some code to do this?

推荐答案

你好jpatrick62,

Hi jpatrick62,

我不知道搜索一些关于你的问题的有用代码,但关于四元数,你可以看看这篇文章:

I don't search some helpful code about your issue, but about quaternion, you can take a look this article:

https://docs.microsoft.com/en-us/dotnet/api/system.windows.media.media3d.quaternion ?view = netframework-4.7.2

和  3-D转换,你也可以看看:

And 3-D Transformations, you can also take a look:

https://docs.microsoft.com/en-us/ dotnet / framework / wpf / graphics-multimedia / 3-d-transformations-overview

希望它没什么帮助。

最好的问候,

Cherry


这篇关于3d立方体的运动上下轴旋转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆