ChimeraX docs icon

Command: view

The view command can:

See also: fly, turn, getcrd, zoom, camera, clip, ui view, mousemode, windowsize, save, matchmaker, align, fitmap, sym, vr, making images, making movies, ChimeraX positions format, Model Panel, Graphics icons

Focusing and Reorienting the View

Usage: view  spec  [ clip  true | false ] [ pad  fraction ] [ cofr  true | false ] [ orient | zalign what ]
Usage: view  initial  model-spec

The view spec command translates the scene, zooms in or out, and (unless clip is false) places the near/far clipping planes to bracket the displayed parts of the specified items. Setting clip false will deactivate any pre-existing near/far clipping and set the center of rotation depth to match that of the center of the bounding box of the specified items. If nothing is specified (spec is blank), all displayed items will be included in the view and near/far clipping deactivated regardless of the clip setting.

The zoom level is adjusted to make the bounding box of the relevant items abut the edges of the graphics window minus a pad fraction (allowed values < 1.0, default 0.05 of the window width and height). The desired fraction will usually be positive, but negative values can be used to zoom in further.

With cofr true (default):

With cofr false, the pre-existing center of rotation method will not be changed. The current center of rotation and the method used to determine it can be reported with the cofr command.

The orient option additionally rotates the scene to a standard orientation with X-axis horizontal increasing rightward, Y-axis vertical increasing upward, and Z-axis perpendicular to the screen increasing toward the viewer; in other words, it aligns scene coordinates with screen coordinates.

Alternatively, zalign can be used to specify what to align along the screen Z-axis:

zalign  atom1  atom2 zalign  atom-spec1 inFrontOf  atom-spec2 zalign  axis-spec zalign  plane-spec

The view initial command removes rotations and translations of models relative to the scene (aligns individual model coordinates with scene coordinates). An overall reset can be achieved with:

view orient; view initial

...where the second command only has an effect if a model has been moved separately, as in matching or fitting.

Named Views and Transitions

Usage: view  name  view-name
Usage: view  view-nameframes ]
Usage: view  deleteview-name | all )
Usage: view  list

The name option assigns view-name to the current view, including the positions of active clipping planes and any models that have been moved separately from the others. Subsequently, that view can be restored over a specified number of image update frames (default 1 frame). A clipping plane will only transition smoothly if present (active) in both the starting and ending views. If a clipping plane is not active, it does not have a position, even though vertical lines are always shown in the Side View.

The information saved with a view does not include the camera mode. It is recommended to save/restore views only when using the perspective (mono) camera mode.

The delete option can be used to “forget” a specific view or all views. The list option reports the names of all currently saved views in the Log, and clicking a name therein restores the corresponding view. User-defined views are saved in sessions.

Rotations and translations of the scene as a whole can be described as motions of the viewer or “camera.” For gradual changes between views (frames > 1), the camera is rotated with a linear change in angle from its orientation in the first view to its orientation in the second view, and simultaneously translated so that the center of rotation in the first view moves in a straight line in screen coordinates to the center of rotation in the second view. At the same time, the positions of any models that have been moved relative to the scene are interpolated between the two views.

Whereas view only interpolates between a pair of views, the fly command can smoothly traverse a series of multiple views, generating a path that visits and leaves the intermediate views without discontinuities in motion. However, an advantage of the view command is that it interpolates clipping plane positions, but fly does not.

Coordinate Systems

The scene coordinate system is subject to any global manipulations (rotations and translations of the scene as a whole) and is the same as the coordinate system of a model that has not been moved relative to other models.

The screen coordinate system has:

Applying Model Position to Other Models

Usage: view position  model-spec  sameAsModels  ref-model-spec

The view position command applies the transformation (rotation and translation relative to the scene) of a reference model to other models. Multiple reference models can be specified, in which case they will be paired in the given order with the models to be moved. Models with the same transformation will not necessarily be superimposed. For superposition, see: matchmaker, align, fitmap

Using Transformation Matrices

Usage: view matrixcamera  matrixC ] [ models  #N,matrixN,#M,matrixM, ... ]

The view matrix command uses input rotation-translation matrices to position the camera (thus the global scene) and/or individual models relative to the scene.

Without arguments, view matrix shows the current rotation and translation of the camera and of each model relative to the scene as matrices in the Log. Each matrix is reported as 12 comma-separated numbers, corresponding to a 3x3 rotation matrix and a translation vector in the fourth column. Ordering is row-by-row, such that the translation vector is given as the fourth, eighth, and twelfth numbers. The same format of each matrix as 12 comma-separated numbers is required to set the position of the camera and/or individually specified models #N, #M, etc. The numbers should be separated by commas only (no spaces).

The following commands are equivalent:

view matrix mod #1,1,0,0,0,0,1,0,0,0,0,1,0
view initial #1

Alternatively, current model positions can be saved to a ChimeraX positions file and later applied from such a file. See also: measure rotation

UCSF Resource for Biocomputing, Visualization, and Informatics / January 2024