Brief Index      Full Index      Events Index      I.M. Reference

Set_Camera_By_Volume

Functions

void Set_Camera_By_Volume (const char *projection, double xmin, double xmax, double ymin, double ymax)
 

Detailed Description

Function Documentation

void Set_Camera_By_Volume ( const char *  projection,
double  xmin,
double  xmax,
double  ymin,
double  ymax 
)

Sets up the Camera so that the screen will show one simple rectangular box extracted from the infinite user data space.

Parameters
projection- Special constant—either "perspective", "orthographic", "stretched", or an "oblique" form (see below). Can be uppercase, lowercase, or any mixture.
xmin- Minimum limit along the X-axis, of what will visible.
xmax- Maximum limit along the X-axis, of what will visible.
ymin- Minimum limit along the Y-axis.
ymax- Maximum limit along the Y-axis.

DETAILS

There are two major methods of determining how much of your scene is going to be visible on the screen— Set_Camera_By_Volume() , and the threesome of Camera Position, Camera Target, and Camera Field (or the general Set_Camera() ). Set_Camera_By_Volume() simplifies things by making some assumptions about the Z-axis. It also defines the field of view in terms of box, which might be more convenient for you, rather than in terms of a center and a radius.

Projection tells the system how to flatten your scene into 2-D and how to pack it into the available screen window. Choices for projection include:

  • perspective
    Generally used for 3-D realistic scenes. The system will arrange that at least as much of your scene as is specified by the (xmin, xmax, ymin, ymax) camera volume will appear on the screen. If the screen window's height-to-width ratio (the "aspect" ratio) is a bit different than the camera volume's, then you'll be able to see a little extra of your scene on the margins.
  • orthographic
    Generally used for 2-D scenes where you want to maintain the aspect ratio, or for 3-D engineering or architectural drawings. As with "perspective", the system will arrange that at least as much of your scene as is specified by the camera volume will appear on the screen. Depending on the aspect ratios, you may be able to see a little more of your scene than you asked for on the left and right or on the top and bottom.
  • stretched
    Generally used for 2-D pictures where it's important that the camera box completely and exactly fill the available screen window, no matter what the camera and window aspect ratios are. The system first does an orthographic projection, then stretches the projection (possibly asymmetrically) to fill the screen window. A typical use would be for a potentiometer display on a menu, where you don't want to worry about the size and shape of the window provided. This can be handy, but note that the stretching process may turn shapes such as circles into ellipses!
  • oblique orthographic
    Similar to orthographic except that the projection has been skewed in the traditional style of mechanical drafting. Orthographic has the problem that objects viewed head-on in wire-frame tend to have their backs and fronts collapsed together. Oblique spreads the back out from the front in a uniform way, keeping equal lengths equal (unlike a perspective projection.) The oblique projection takes one or two floating-point constants—the angle in degrees to skew by in X and Y. See Set_Camera_Projection() for more details.
  • oblique perspective
    Similar to perspective except that the projection (or the projection plane) has been skewed. It is useful for off-center viewing, as when doing stereo projections. See Set_Camera_Projection() for more details.

The arguments that Set_Camera_By_Volume() passes to Set_Camera() are as follows: the camera projection is passed straight through, the up vector is set to (0.0, 1.0, 0.0), the field is set to max ( xmax - xmin, ymax - ymin ), the target is set to

cam0.gif

and the camera position is set to

camfld.gif

The "-2.5" is chosen so the view will be reasonable if you've chosen a perspective projection, or if you later toggle to a perspective projection.

NOTES

For historical reasons the words for the regular projections can be abbreviated. The oblique projections cannot be abbreviated.

RESTRICTIONS

See Also
Set_Camera, Set_Camera_Field, Set_Camera_Position, Set_Camera_Projection, Set_Camera_Target, Set_Camera_Up_Vector, Zoom_Camera, Orbit_Camera, Pan_Camera, Dolly_Camera, Roll_Camera, Set_Window, Translate_Object, Rotate_Object.

Brief Index      Full Index      Events Index      I.M. Reference