File: transform.html

package info (click to toggle)
geomview 1.9.4-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 21,772 kB
  • ctags: 11,826
  • sloc: ansic: 90,886; sh: 9,802; cpp: 1,215; makefile: 1,064; objc: 263; yacc: 149; tcl: 76; lex: 70
file content (153 lines) | stat: -rw-r--r-- 6,928 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<html lang="en">
<head>
<title>transform - Geomview Manual</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Geomview Manual">
<meta name="generator" content="makeinfo 4.8">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Non_002dgeometric-objects.html#Non_002dgeometric-objects" title="Non-geometric objects">
<link rel="prev" href="image.html#image" title="image">
<link rel="next" href="ntransform.html#ntransform" title="ntransform">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
  span.sc    { font-variant:small-caps }
  span.roman { font-family:serif; font-weight:normal; } 
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
--></style>
</head>
<body>
<div class="node">
<p>
<a name="transform"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="ntransform.html#ntransform">ntransform</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="image.html#image">image</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Non_002dgeometric-objects.html#Non_002dgeometric-objects">Non-geometric objects</a>
<hr>
</div>

<h4 class="subsection">4.3.3 Transform Objects</h4>

<p>Where a single 4x4 matrix is expected &ndash; as in the <code>INST</code>
<code>transform</code> field, the camera's <code>camtoworld</code> transform and the
Geomview <code>xform*</code> commands &ndash; use a transform object.

   <p>Note that a transform is distinct from a <code>TLIST</code>, which is a type
of geometry.  <code>TLIST</code>s can contain one or more 4x4 transformations;
"transform" objects must have exactly one.

   <p>Why have both?  In many places &ndash; e.g. camera positioning &ndash; it's only
meaningful to have a single transform.  Using a separate object type
enforces this.

   <p>Syntax for a transform object is

<pre class="example">     &lt;transform&gt; ::=
       [ "{" ]             (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" &lt;name&gt; ]
                           (defines a transform named &lt;name&gt;, setting
                            its value from the stuff which follows)
     
           &lt;sixteen floating-point numbers&gt;
                           (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)
        |
           "&lt;" &lt;filename&gt;  (meaning: read transform from that file)
        |
           ":" &lt;name&gt;      (meaning: use variable &lt;name&gt;,
                             defined elsewhere; if undefined the initial
                             value is the identity transform)
     
      [ "}" ]              (matching curly brace)
</pre>
   <p>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.

   <p>Some examples, in contexts where they might be used:

<pre class="example">     # 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
         }
     )
</pre>
   <pre class="example">     # 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 }
     }
</pre>
   <!--  -->
<div class="node">
<p>
<a name="transform"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="transform_002dincr.html#transform_002dincr">transform-incr</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="time_002dinterests.html#time_002dinterests">time-interests</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="GCL-Reference.html#GCL-Reference">GCL Reference</a>
<hr>
</div>

<h4 class="subsection">7.2.125 transform</h4>

<p><a name="index-transform-133"></a>
     <dl>
<dt><code>(transform objectID centerID frameID [rotate|translate|translate-scaled|scale] x y z [bbox-center|origin] [dt [smooth]])</code><dd>Apply a motion (rotation, translation, scaling) to object <code>objectID</code>;
that is, construct and concatenate a transformation matrix with
objectID's transform  The 3 IDs involved are the object
that moves, the center of motion, and the frame of reference
in which to apply the motion.  The center is easiest understood
for rotations: if centerID is the same as objectID then it will
spin around its own axes; otherwise the moving object will orbit
the center object.  Normally frameID, in whose coordinate system
the (mouse) motions are interpreted, is <code>focus</code>, the current camera. 
Translations can be scaled proportional to the
distance between the target and the center. Support for
spherical and hyperbolic as well as Euclidean space is
built-in: use the <code>space</code> command to change spaces.  With type
<code>rotate</code> x, y, and z are floats specifying angles in RADIANS. 
For types <code>translate</code> and <code>translate-scaled</code> x, y, and z are
floats specifying distances in the coordinate system of the
center object.

     <p>The next field is optional and may consist of the keyword
<code>bbox-center</code> or the keyword <code>origin</code> and modifies the
location of the origin of <var>objectID</var>'s co-ordinate frame:
<code>bbox-center</code> temporarily translates <var>objectID</var>'s co-ordinate
frame to the center of <var>objectID</var>'s bounding box. <code>origin</code> is
the default (and means not to modify <var>objectID</var>'s co-ordinate frame)
and <code>bbox-center</code> is only valid in Euclidean space.

     <p>The optional <code>dt</code> field allows a simple form of
animation; if present, the object moves by just that amount during
approximately <code>dt</code> seconds, then stops.  If present and followed by
the <code>smooth</code> keyword, the motion is animated with a 3t^2-2t^3
function, so as to start and stop smoothly.  If absent, the motion is
applied immediately. 
</dl>

   </body></html>