transform objects - Geomview Manual
Description: Geomview Manual

Next: ntransform objects, Previous: image objects, Up: Non-geometric objects

#### 4.3.3 Transform Objects

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. `TLIST`s 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 }
         }