简体   繁体   中英

Searching mathematical algorithm for vector calculation

I have given directions of 3D Objects like this:

Direction1:

X-Vector:

X_X: 1

X_Y: 0

X_Z: 0

Y-Vector:

Y_X: 0

Y_Y: 1

Y_Z: 0

Z-Vector:

Z_X: 0

Z_Y: 0

Z_Z: 1

Direction2:

X-Vector:

X_X: 0

X_Y: 0

X_Z: 1

Y-Vector:

Y_X: 0

Y_Y: -1

Y_Z: 0

Z-Vector:

Z_X: 1

Z_Y: 0

Z_Z: 0

That looks like this (Direction1 on the left, Direction2 on the right):

在此处输入图片说明

I have to filter out the information about the rotation from direction1 to direction2 now. There are algorithms fe which calculates the rotation of vector1 to vector 2, but here i have 3 vectors and i don't know, how i can calculate the euler rotation angle here.

I thought about summarizing the 3 Vectors to 1, fe picture 1 would be (1,1,1) and pic2 would be (1,-1,1), but the problem here is that the information, which axe points in which direction gets lost. Has somebody an idea?

Seems that you want to find affine transformation that transforms one triplet of non-coplanar vectors into another triplet.
Make matrices A and B and unknown rotation matrix M .
Here column vector like x1 y1 z1 is your X_X X_Y X_Z and so on.

 M * A = B

    |x1 x2 x3 0|     |x1` x2` x3` 0|
M * |y1 y2 y3 0| =   |y1` y2` y3` 0|
    |z1 z2 z3 0|     |z1` z2` z3` 0| 
    |1  1  1  1|     |1   1   1   1| 

find inverse matrix InvA for the A and multiply both sides by IA

M * A * InvA = B * InvA
M * |1 |= B * InvA
M = B * InvA

Now you have matrix M needed to transform vectors.

Rotation about 5,0,0

      |1 0 0 -5|        |1 0 0 5|
M' =  |0 1 0  0| * M *  |0 1 0 0|
      |0 0 1  0|        |0 0 1 0|
      |0 0 0  1|        |0 0 0 1|

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