79451312

Date: 2025-02-19 12:31:15
Score: 0.5
Natty:
Report link

now we import vpython rather than import vis library.

And now the axis is same as the x axis, up axis is same as y axis.

Euler angle (that is, the roll, pitch, and yaw you are using now) can be convert to a rotate matrix, and my method is use rotate matrix to assign the vector to up and axis.

So first you need to do the convertion of euler angle to rotate matrix. You can google this and find the convert method.

Now, all you need to do is split a rotate matrix to x, y and z vector, and assign y to up, and x to axis.

Say, you have a rotate matrix (I don't know how to use a latex matrix in stackoverflow, so you see this):

    r11 r12 r13
R = r21 r22 r23
    r31 r32 r33

and x vector would be a column vector of the first column:

    r11
x = r21
    r31

and y vector would be the second column, z vector would be the third column:

    r12      r13
y = r22, z = r23
    r32      r33

After that, you just neet to do this in your python code:

element.axis = x
element.up = y

(sorry about my bad english)

Reasons:
  • Blacklisted phrase (1): stackoverflow
  • Long answer (-1):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: PenGoFox Liang