OpenDX - Documentation
Full Contents QuickStart Guide User's Guide User's Reference
Previous Page Next Page Table of Contents Partial Table of Contents Index Search

AutoCamera

Category

Rendering

Function

Constructs a camera for viewing an object.

Syntax


camera = AutoCamera(object, direction, width, resolution,
                    aspect, up, perspective, angle, background);

Inputs
Name Type Default Description
object object or vector none object to be looked at
direction vector, string, or object "front" position of camera
width scalar or object input dependent width of field of view
resolution integer 640 pixels across image
aspect scalar 0.75 height/width
up vector [0 1 0] up direction
perspective flag 0 0: orthographic projection
1: perspective projection
angle scalar 30.0 view angle (in degrees) (for perspective projection)
background vector or string "black" image background color

Outputs
Name Type Description
camera camera resulting camera

Functional Details

This module differs from Camera in specifying a direction from which to view a specified object. (Camera specifies a "look-from" point.) It will automatically create an appropriate Camera for a given object for use with Display or Render.

object

is the object for which a camera is to be created. You can specify this parameter as a 3-dimensional position in space. In that case, width must also be explicitly specified (see below) as a numeric value, since the module has no means of estimating object size.

direction

specifies the direction from the camera eye to the center of the object and can be any of the following strings: "front," "back," "left," "right," "top," "bottom," and their corresponding "off" values ("off-front," "off-back," etc., which are all slightly offset from the direct positions). Hyphens and spaces are not required for the offset (i.e., "offleft" and "off left" are both valid, and Data Explorer ignores capitalization.

The direction "front" means from the positive z direction; "back" means from the negative z direction; "left" means from the negative x direction, "top" means from the positive y direction, and so on.

Note: This parameter controls only the direction of viewing; it does not allow you inside the object. For interior views, use the ClipPlane or ClipBox module, make the object translucent, or use the Camera module in perspective mode.

This parameter can also be specified as a vector to be added to the look-to point. You can use the Direction module for constructing look-from directions. But note that only the direction of the parameter is important; its magnitude does not affect the size of the object in the image.

width

specifies the width of the image in the units of object.

resolution

specifies the width of the image in pixels.

aspect

specifies the height-to-width ratio of the image.

up

specifies a vector that will be aligned with the vertical axis of the image. The default is [0 1 0].

perspective

specifies the method of projection used in rendering object. The choices are perspective (0) and orthographic (1).

Perspective projection

This method produces a realistic rendering of objects, but does not preserve the exact shape and measurements of the object (e.g., parallel lines usually do not project as being parallel). The camera is positioned at the vertex of the viewing angle (see angle below). The base of this angle is determined by the width parameter. Thus the actual camera position is determined by width and angle along the direction vector.

Orthographic projection

This method produces a somewhat artificial view of an object (the distance between the front and back of an object appears small compared to the distance between the object and the camera), but it preserves exact scale measurements and parallel lines.

The angle parameter has no effect on orthographic projection. The size of the object can be changed only by width (the default is a field of view slightly greater than the width of the object).

For more information on these projection methods, consult a text on computer graphics.

angle

specifies the viewing angle in degrees for perspective projection.

background

specifies the color of the image background as either an RGB color or a color-name string. The string can be any of the defined color-name strings (see Color).

Example Visual Programs

MovingCamera.net
PlotLine.net
PlotTwoLines.net
UsingCompute.net
UsingMorph.net

See Also

 Camera,  Color,  Direction,  Render,  Display


Full Contents QuickStart Guide User's Guide User's Reference

[ OpenDX Home at IBM | OpenDX.org ]