| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The syntax of these objects is given in the form used in See section Embedded objects and external-object references, where "quoted" items should appear literally but without quotes, square bracketed ([ ]) items are optional, and | separates alternative choices.
| 4.3.1 Transform Objects | Transformation matrices. | |
| 4.3.2 cameras | Cameras. | |
| 4.3.3 window | Windows. |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Where a single 4x4 matrix is expected - as in the
INST transform field, the camera's camtoworld transform
and the Geomview xform* commands - use a transform object.
Note that a transform is distinct from a TLIST, which is a type
of geometry. TLISTs can contain one or more 4x4 transformations;
"transform" objects must have exactly one.
Why have both? In many places - e.g. camera positioning - it's only meaningful to have a single transform. Using a separate object type enforces this.
Syntax for a transform object is
<transform> ::=
[ "{" ] (curly brace, generally needed to make
the end of the object unambiguous.)
[ "transform" ] (optional keyword; unnecessary if the type
is determined by the context, which it
usually is.)
[ "define" <name> ]
(defines a transform named <name>, setting
its value from the stuff which follows)
<sixteen floating-point numbers>
(interpreted as a 4x4 homogeneous transform
given row by row, intended to apply to a
row vector multiplied on its LEFT, so that e.g.
Euclidean translations appear in the bottom row)
|
"<" <filename> (meaning: read transform from that file)
|
":" <name> (meaning: use variable <name>,
defined elsewhere; if undefined the initial
value is the identity transform)
[ "}" ] (matching curly brace)
|
The whole should be enclosed in { braces }. Braces are not essential if exactly one of the above items is present, so e.g. a 4x4 array of floats standing alone may but needn't have braces.
Some examples, in contexts where they might be used:
# Example 1: A gcl command to define a transform
# called "fred"
(read transform { transform define fred
1 0 0 0
0 1 0 0
0 0 1 0
-3 0 1 1
}
)
|
# Example 2: A camera object using transform
# "fred" for camera positioning
# Given the definition above, this puts the camera at
# (-3, 0, 1), looking toward -Z.
{ camera
halfyfield 1
aspect 1.33
camtoworld { : fred }
}
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A camera object specifies the following properties of a camera:
specified by either a camera-to-world or world-to-camera transformation; this transformation does not include the projection, so it's typically just a combination of translation and rotation. Specified as a transform object, typically a 4x4 matrix.
Intended to suggest a typical distance from the camera to the object of interest; used for default camera positioning (the camera is placed at (X,Y,Z) = (0,0,focus) when reset) and for adjusting field-of-view when switching between perspective and orthographic views.
True aspect ratio in the sense <Xsize>/<Ysize>. This normally should agree with the aspect ratio of the camera's window. Geomview normally adjusts the aspect ratio of its cameras to match their associated windows.
Note that both must be strictly greater than zero. Very large <far>/<near> distance ratios cause Z-buffering to behave badly; part of an object may be visible even if somewhat more distant than another.
Specified in either of two forms.
is the field of view - in degrees if perspective, or linear distance if orthographic - in the shorter direction.
is half the projected Y-axis field, in world coordinates (not angle!), at unit distance from the camera. For a perspective camera, halfyfield is related to angular field:
halfyfield = tan( Y_axis_angular_field / 2 )
while for an orthographic one it's simply:
halfyfield = Y_axis_linear_field / 2
This odd-seeming definition is (a) easy to calculate with and (b) well-defined in both orthographic and perspective views.
The syntax for a camera is:
<camera> ::=
[ "camera" ] (optional keyword)
[ "{" ] (opening brace, generally required)
[ "define" <name> ]
"<" <filename>
|
":" <name>
|
(or any number of the following,
in any order…)
"perspective" {"0" | "1"} (default 1)
(otherwise orthographic)
"stereo" {"0" | "1"} (default 0)
(otherwise mono)
"worldtocam" <transform> (see transform syntax above)
"camtoworld" <transform>
(no point in specifying both
camtoworld and worldtocam; one is
constrained to be the inverse of the other)
"halfyfield" <half-linear-Y-field-at-unit-distance>
(default tan 40/2 degrees)
"fov" (angular field-of-view if perspective,
linear field-of-view otherwise.
Measured in whichever direction is smaller,
given the aspect ratio. When aspect ratio
changes -- e.g. when a window is reshaped --
"fov" is preserved.)
"frameaspect" <aspect-ratio> (X/Y) (default 1.333)
"near" <near-clipping-distance> (default 0.1)
"far" <far-clipping-distance> (default 10.0)
"focus" <focus-distance> (default 3.0)
[ "}" ] (matching closebrace)
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A window object specifies size, position, and other window-system related information about a window in a device-independent way.
The syntax for a window object is:
window ::=
[ "window" ] (optional keyword)
[ "{" ] (curly brace, often required)
(any of the following, in any order)
"size" <xsize> <ysize>
(size of the window)
"position" <xmin> <xmax> <ymin> <ymax>
(position & size)
"noborder"
(specifies the window should
have no window border)
"pixelaspect" <aspect>
(specifies the true visual aspect ratio
of a pixel in this window in the sense
xsize/ysize, normally 1.0.
For stereo hardware which stretches the
display vertically by a factor of 2,
``pixelaspect 0.5'' might do.
The value is used when computing the
projection of a camera associated with
this window.)
[ "}" ] (matching closebrace)
|
Window objects are used in the Geomview window and
ui-panel commands to set default properties for future windows or
to change those of an existing window.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] |
This document was generated by Steve M. Robbins on June, 22 2006 using texi2html 1.76.