Closed TheRealVira closed 3 years ago
In 3D, rotation is a bit more complex because there are 3 axes to rotate around rather than just one which means that you'll need 6 keys instead of just 4 to control them all (assuming you're interested in all 3).
As for actually controlling the orientation, the only function vtkplotlib provides is view() which sets absolute orientations using unit vectors but I imagine that you want the exact opposite - to incrementally adjust the orientation using yaw, pitch and roll angles. In which case you can use VTK's own methods directly. The camera is located at fig.camera
. To give you an example:
import vtkplotlib as vpl
fig = vpl.figure()
vpl.mesh_plot(vpl.data.get_rabbit_stl())
text = vpl.text("", color="r")
while True:
text.text = "Incrementing Yaw"
for i in range(120):
fig.camera.Yaw(3)
fig.reset_camera()
fig.update()
text.text = "Incrementing Pitch"
for i in range(120):
fig.camera.Pitch(3)
fig.reset_camera()
fig.update()
text.text = "Incrementing Roll"
for i in range(120):
fig.camera.Roll(3)
fig.reset_camera()
fig.update()
Thank you - that was very useful!
You're welcome.
Hi! I am currently working on a 3D to 2D ASCII art plotter and am using your library for it. You can read more information about that here:
https://github.com/TheRealVira/asciisight
Anyways... The rotation seems to be a bit broken and I am just very confused as of why. Another solution would have been to rotate the figure itself, but I don't seem to find any function for that inside your API. Feedback would be very appreciated 😄
Looking forward to hearing from you!