I have created a small test program that creates vtkSliderWidgets with the vtkSliderRepresentation3D. I create one slider per axis (not necessarily along the main coordinate system axes). Even though the three sliders have the same start point, one of the sliders seems to start offset from the start point and pointing slightly in the wrong direction.
sliderRep->SetPoint1InWorldCoordinates(0.0, 0.0, -6.0); // Note: All sliders have the same start point
sliderRep->SetPoint2InWorldCoordinates(x, y, z);
The (x,y,z) coordinates for the axes are the following where the x-axis looks rotated incorrectly:
vtkSliderRepresentation3D seems to want to rotate some geometry aligned along the x-axis with the slider axis defined by point1 and point2. Could there be an issue with the rotation calculation?
Also note that I have tried using vtkLineWidget instead of vtkSliderWidget and that seems to render the axes correctly with the correct start point and end point.
Not the same starting point is a minor issue compared to the text being distorted and mirrored. You would normally use these sliders in a 2D renderer layer that does not move/rotate with your 3D scene content.
My application does use sliders a part of a scene that can be rotated. Seems this could be a normal use case scenario? Currently used for moving slices inside a volume dataset.
The start point is incorrect, but so is probably the end point since the rotation used is probably not what it should be (guess maybe the middle point could be correct though ) .
I do believe correctness should be important when it comes to positioning though also agree that text should be readable preferably from any rotation. Think the position issue could easily be fixed?
My application does use sliders a part of a scene that can be rotated. Seems this could be a normal use case scenario? Currently used for moving slices inside a volume dataset.
I recently implemented something very similar but I dont get the problem with the widgets orientation:
I have tried swapping the coordinates as well, but the situation is still the same/similar. Have you tried to use the coordinates I provided? Would be interesting if you can reproduce the situation. In your post you use the main coordinate axes which I think should work fine for me as well.
I have found vtkSliderRepresentation3D::BuildRepresentation to calculate an incorrect angle of rotation of the slider mesh in some cases. I have tried correcting this by replacing:
Basically a directional angle is found instead of the one found by asin, and that seems to work for my case. Haven’t tested this a lot yet, but seems to work for me right now. Hopefully a similar fix can be made to VTK as well