How to exactly rotate the data in Tables
Posted: Wed Sep 02, 2020 8:40 pm
Hi all,
I am trying to replicate the osimC3D script made by you in Matlab into python, especifically I am building the function to rotate some axis in the markers and force tables. I have the following code:
Running the script a ValueError is raised:
This is asking for three arguments. However, in the API documentation is indicated that only two arguments are needed.
Can you please let me know how to call the Rotation function in the API to set an angle for rotation, to set the axis of rotation and, to multiply by a row vector.
I am trying to replicate the osimC3D script made by you in Matlab into python, especifically I am building the
Code: Select all
rotateTable
Code: Select all
def rotateTable(self, table, axisString, value):
value_rad = np.deg2rad(value)
#set up the transform
if axisString == 'x':
axis = simb.CoordinateAxis_getCoordinateAxis(0)
elif axisString == 'y':
axis = simb.CoordinateAxis_getCoordinateAxis(1)
elif axisString == 'z':
axis = simb.CoordinateAxis_getCoordinateAxis(2)
#Rotation() works on each row.
R = simb.Rotation_setRotationFromAngleAboutAxis(value_rad, axis)
for iRow in range(table.getNumRows()):
#get a row from the table
rowVec = table.getRowAtIndex(iRow)
rowVec_rotated = simb.Rotation_multiply(R, rowVec)
table.setRowAtIndex(iRow,rowVec_rotated)
return table
R = simb.Rotation_setRotationFromAngleAboutAxis(value_rad, axis)
TypeError: Rotation_setRotationFromAngleAboutAxis() takes exactly 3 arguments (2 given)
This is asking for three arguments. However, in the API documentation is indicated that only two arguments are needed.
Can you please let me know how to call the Rotation function in the API to set an angle for rotation, to set the axis of rotation and, to multiply by a row vector.