Difference between revisions of "Model Space and Camera Space"

From PyMOLWiki
Jump to: navigation, search
(Created page with 'Objects are defined in a Cartesian coordinate system, i.e. as xyz coordinates for each atom (or surface point or corner or...). This coordinate system is model space. To make obj…')
 
(Added links to other PW pages. Removed unnecessary line breaks. Updated some language for clarity.)
 
Line 1: Line 1:
Objects are defined in a Cartesian coordinate system, i.e. as xyz
+
Objects are defined in a Cartesian coordinate system, i.e. as xyz coordinates for each atom (or surface point or corner or...). This coordinate system is model space. To make objects visible, PyMOL places a "camera" such that it sees most of the molecule. The picture that is shown on the screen is the image that is "taken" by the camera. Initially, after loading an object, the camera is placed such that it looks on the object parallel to the model's z axis. The model's x and y axes are horizontal and vertical, respectively. So, initially, the model axes correspond to the physical directions of the screen: x and y are horizontal and vertical, z is perpendicular to the screen.   
coordinates for each atom (or surface point or corner or...). This
 
coordinate system is model space. To make objects visible, PyMOL
 
places a "camera" such that it sees most of the molecule. The picture
 
that is shown on the screen is the image that is taken by the
 
camera. Initially, after loading an object, the camera is placed such
 
that it looks on the object parallel to the z axis. x and y axes are
 
horizontal respectively vertical. In the beginning, the axes
 
correspond to the physical directions of the screen: x and y are
 
horizontal /vertical, z is perpendicular to the screen.  To change the
 
view, normally the camera is moved: view of all the objects is changed
 
simultaneously, the objects are not moved relative to each
 
other. After changing the view, x, y and z axes don't correspond to
 
the directions of the screen anymore.
 
  
turn, move, center, zoom, orient and mouse action in viewing mode move the
+
In normal operation, to change the view, the camera is moved and the view of all objects is changed simultaneously; that is, the objects are not moved relative to one other. After changing the view, the x, y and z axes of model space no longer correspond to the directions of the screen.  The commands [[turn]], [[move]], [[center]], [[zoom]], and [[orient]], as well as mouse action in viewing mode, can be used to move the camera in object space.
camera in object space.
 
  
For easy description of object movement relative to the camera, an
+
For easy description of object movement relative to the camera, an additional coordinate system is defined: Camera space. The camera is situated in the origin of camera space, x and y are horizontal respectively vertical and z is the viewing direction. Camera space always corresponds to the physical directions of the screen--x and y are horizontal and vertical, and z is perpendicular to the screen.  The relation between camera space and model space is described in the view matrix (see [[get_view]]).  
additional coordinate system is defined: Camera space. The camera is
 
situated in the origin of camera space, x and y are horizontal
 
respectively vertical and z is the viewing direction. Camera space
 
always corresponds to the directions of the screen.
 
  
The relation of camera space and model space is described in the view matrix. (See
+
Changing the coordinates in model space is only necessary when objects must be moved relative to each other or when the transformed coordinates are to be written into a file. Model space coordinates can be changed with the commands [[rotate]], [[translate]], and [[transform_selection]], or with the mouse in editing mode.
get_view).
 
 
 
Changing the coordinates in model space is only necessary when objects shall
 
be moved relative to each other or when the transformed coordinates
 
are to be written into a file.  
 
 
 
Model space coordinates can be changed with the commands rotate and
 
translate, transform_selection or with the mouse in editing mode.
 
  
  
 +
== Space and File saving ==
  
== Space and File saving ==
+
When model coordinates are [[save|saved]] (e.g. as a pdb file), PyMOL uses model space coordinates. In contrast, when a specific view is saved as [[PovRay]] or [[vrml]], camera space coordinates are used (unless [[geometry_export_mode]] is turned on, in which case no camera or lighting information is included in the output file).
  
When  model coordinates are saved (e.g. as a pdb file), PyMOL uses
+
When image files in model space coordinates are needed, first choose colors and representations as needed, then align camera space to model space:
model space coordinates. In contrast, when an image is saved as povray
 
or vrml, camera space coordinates are used. When image files in model
 
space coordinates are needed, first choose colors and representations
 
as needed, then align camera space to model space:
 
  
 
<source lang="python">
 
<source lang="python">
Line 53: Line 24:
 
</source>
 
</source>
  
After setting the view, the molecule will probably be out of sight but
+
After setting the view, the molecule will probably be out of sight but will be saved to the file nonetheless. This can be used e.g. to receive a list of surface points in model space.
anyway it will be saved to the file. This can be used e.g. to receive
 
a list of surface points in model space.
 
 
 
 
 
----
 
  
 
== See Also ==
 
== See Also ==

Latest revision as of 13:32, 19 February 2014

Objects are defined in a Cartesian coordinate system, i.e. as xyz coordinates for each atom (or surface point or corner or...). This coordinate system is model space. To make objects visible, PyMOL places a "camera" such that it sees most of the molecule. The picture that is shown on the screen is the image that is "taken" by the camera. Initially, after loading an object, the camera is placed such that it looks on the object parallel to the model's z axis. The model's x and y axes are horizontal and vertical, respectively. So, initially, the model axes correspond to the physical directions of the screen: x and y are horizontal and vertical, z is perpendicular to the screen.

In normal operation, to change the view, the camera is moved and the view of all objects is changed simultaneously; that is, the objects are not moved relative to one other. After changing the view, the x, y and z axes of model space no longer correspond to the directions of the screen. The commands turn, move, center, zoom, and orient, as well as mouse action in viewing mode, can be used to move the camera in object space.

For easy description of object movement relative to the camera, an additional coordinate system is defined: Camera space. The camera is situated in the origin of camera space, x and y are horizontal respectively vertical and z is the viewing direction. Camera space always corresponds to the physical directions of the screen--x and y are horizontal and vertical, and z is perpendicular to the screen. The relation between camera space and model space is described in the view matrix (see get_view).

Changing the coordinates in model space is only necessary when objects must be moved relative to each other or when the transformed coordinates are to be written into a file. Model space coordinates can be changed with the commands rotate, translate, and transform_selection, or with the mouse in editing mode.


Space and File saving

When model coordinates are saved (e.g. as a pdb file), PyMOL uses model space coordinates. In contrast, when a specific view is saved as PovRay or vrml, camera space coordinates are used (unless geometry_export_mode is turned on, in which case no camera or lighting information is included in the output file).

When image files in model space coordinates are needed, first choose colors and representations as needed, then align camera space to model space:

set_view (\
     1,    0,    0,\
     0,    1,    0,\
     0,    0,    1,\
     0,    0,    0,\
     0,    0,    0,\
     0,    300,  1 )

After setting the view, the molecule will probably be out of sight but will be saved to the file nonetheless. This can be used e.g. to receive a list of surface points in model space.

See Also

turn, move, center, zoom, orient, rotate, translate, Transform_selection, Get_View