简体   繁体   中英

How to get rotation(Euler angle) between two 3D vectors? (to make bvh format)

I'm converting a 3d coordinate sequence into a bvh file. I made the HIERARCHY using the first frame(not T-pose), and I want to use the rest of the frames to make the MOTION part.

I don't know the exact meaning of the euler angle used in the bvh format. For example, when there are two vectors v1 and v2 as shown in the picture below

在此处输入图像描述

v1 = (X1, Y1, Z1) v2 = (X2, Y2, Z2)

The two vectors were the same length and rotated from v1 to v2.

How can I get rotation(Euler angle in bvh format) between 2 vectors?

I don't know if this answers the "meaning" of the Euler angle in BVH format, but in BVH the Euler angles of a bone in a given frame represent the rotation of the bone from the base position, not from the previous frame. The base position is the OFFSET defined in the HIERARCHY. You should check out Motion Capture File Formats Explained by Meredith and Maddock, they offer a more in-depth discussing about the BVH file format.

To find a rotation matrix to rotate vector v1 onto vector v2 you can use the equation provided in Jur van den Berg's answer here . Then, you can recover the Euler Angles using Shoemake's algorithm , note that the order of rotation will change the equations. But if your bone's base position does not lie on v1, you need to compute the rotation from its base position and not from v1.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM