hi everyone. I'm a new user of pyode. I'm trying to use GeomCylinders but I'm having problems setting the rotation of the geoms to certain angle ranges--90 to 180, 270 to 360, 0 to -90 and -180 to -270 degrees. I'm not sure if the problem lies with my function for converting a given axis and angle to a quaternion (the code of which is included below), but I've already tried the rotation matrix approach and I'm still having the same problem. I hope I have stated my problem clearly. If anyone knows what I'm doing wrong or what I should be doing instead, please help. I'm afraid I'm running out of options :) Many thanks!!
def GetQuaternion(axis, angle):
"""
Returns the quaternion equivalent of given axis and angle.
"""
angle *= 0.5
axis = norm(vector(axis))
sinAngle = sin(angle)
x = (axis.x * sinAngle)
y = (axis.y * sinAngle)
z = (axis.z * sinAngle)
w = cos(angle)
q = Quaternion(w, x, y, z)
return q
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
hi everyone. I'm a new user of pyode. I'm trying to use GeomCylinders but I'm having problems setting the rotation of the geoms to certain angle ranges--90 to 180, 270 to 360, 0 to -90 and -180 to -270 degrees. I'm not sure if the problem lies with my function for converting a given axis and angle to a quaternion (the code of which is included below), but I've already tried the rotation matrix approach and I'm still having the same problem. I hope I have stated my problem clearly. If anyone knows what I'm doing wrong or what I should be doing instead, please help. I'm afraid I'm running out of options :) Many thanks!!
def GetQuaternion(axis, angle):
"""
Returns the quaternion equivalent of given axis and angle.
"""
angle *= 0.5
axis = norm(vector(axis))
sinAngle = sin(angle)
x = (axis.x * sinAngle)
y = (axis.y * sinAngle)
z = (axis.z * sinAngle)
w = cos(angle)
q = Quaternion(w, x, y, z)
return q