pyvista.RenderWindowInteractor.enable_terrain_style#
- RenderWindowInteractor.enable_terrain_style(mouse_wheel_zooms=False, shift_pans=False)[source]#
Set the interactive style to Terrain.
Used to manipulate a camera which is viewing a scene with a natural view up, e.g., terrain. The camera in such a scene is manipulated by specifying azimuth (angle around the view up vector) and elevation (the angle from the horizon). Similar to the default Trackball Camera style and in contrast to the Joystick Camera style, movements of the mouse translate to movements of the camera.
Left mouse click rotates the camera around the focal point using both elevation and azimuth invocations on the camera. Left mouse motion in the horizontal direction results in azimuth motion; left mouse motion in the vertical direction results in elevation motion. Therefore, diagonal motion results in a combination of azimuth and elevation. (If the shift key is held during motion, then only one of elevation or azimuth is invoked, depending on the whether the mouse motion is primarily horizontal or vertical.) Middle mouse button pans the camera across the scene (again the shift key has a similar effect on limiting the motion to the vertical or horizontal direction. The right mouse is used to dolly towards or away from the focal point (zoom in or out). Panning and zooming behavior can be overridden to match the Trackball Camera style.
The class also supports some keypress events. The
r
key resets the camera. Thee
key invokes the exit callback and closes the plotter. Thef
key sets a new camera focal point and flies towards that point. Theu
key invokes the user event. The3
key toggles between stereo and non-stero mode. Thel
key toggles on/off latitude/longitude markers that can be used to estimate/control position.- Parameters:
- mouse_wheel_zoomsbool, default:
False
Whether to use the mouse wheel for zooming. By default zooming can be performed with right click and drag.
- shift_pansbool, default:
False
Whether shift + left mouse button pans the scene. By default shift + left mouse button rotates the view restricted to only horizontal or vertical movements, and panning is done holding down the middle mouse button.
- mouse_wheel_zoomsbool, default:
Examples
Create a simple scene with a plotter that has the Terrain interactive style:
>>> import pyvista as pv >>> plotter = pv.Plotter() >>> _ = plotter.add_mesh(pv.Cube(center=(1, 0, 0))) >>> _ = plotter.add_mesh(pv.Cube(center=(0, 1, 0))) >>> plotter.show_axes() >>> plotter.enable_terrain_style() >>> plotter.show()
Use controls that are closer to the default style:
>>> plotter = pv.Plotter()
>>> _ = plotter.add_mesh(pv.Cube(center=(1, 0, 0))) >>> _ = plotter.add_mesh(pv.Cube(center=(0, 1, 0))) >>> plotter.show_axes() >>> plotter.enable_terrain_style( ... mouse_wheel_zooms=True, shift_pans=True ... ) >>> plotter.show()