vtkOpenVRRenderWindowInteractor::ConvertPoseToWorldCoordinates quaternion output
Hello,
This issue is mostly a question for @ken-martin
I am trying to reconstruct the 4x4 matrix of a device pose in Slicer, see https://github.com/adamrankin/SlicerOpenVR/commit/98f3809e7d6128459d81b811936b8f45c99bc832
specifically:
void qMRMLVirtualRealityViewPrivate::updateTransformNodeWithControllerPose(vtkEventDataDevice device)
and I am using vtkOpenVRRenderWindowInteractor::ConvertPoseToWorldCoordinates
I reconstruct the 4x4 matrix by doing
double A[3][3];
vtkMath::QuaternionToMatrix3x3(wxyz, A);
vtkSmartPointer<vtkMatrix4x4> mat = vtkSmartPointer<vtkMatrix4x4>::New();
for (int i = 0; i < 3; ++i)
{
for (int j = 0; j < 3; j++)
{
mat->SetElement(i, j, A[i][j]);
}
mat->SetElement(i, 3, pos[i]);
}
however the value of A is always 3x3 identity (with some minor deviations).
Am I doing something incorrectly? How can I recover the rotation of the controller from the pose data in Slicer (world) coordinates?
Thanks for any help you can provide, Adam