File: s_149.html

package info (click to toggle)
povray 1%3A3.6.1-6
  • links: PTS
  • area: non-free
  • in suites: etch, etch-m68k
  • size: 31,052 kB
  • ctags: 20,305
  • sloc: ansic: 110,032; cpp: 86,573; sh: 13,595; pascal: 5,942; asm: 2,994; makefile: 1,747; ada: 1,637
file content (349 lines) | stat: -rw-r--r-- 9,514 bytes parent folder | download | duplicates (2)
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349

<!--  This file copyright Persistence of Vision Raytracer Pty. Ltd. 2003-2004  -->
<html> 
<head>
  
<!--  NOTE: In order to users to help find information about POV-Ray using  -->
 
<!--  web search engines, we ask you to *not* let them index documentation  -->
 
<!--  mirrors because effectively, when searching, users will get hundreds  -->
 
<!--  of results containing the same information! For this reason, the two  -->
 
<!--  meta tags below disable archiving and indexing of this page by all  -->
 
<!--  search engines that support these meta tags.  -->
 
 <meta content="noarchive" name="robots">
   
 <meta content="noindex" name="robots">
   
 <meta content="no-cache" http-equiv="Pragma">
   
 <meta content="0" http-equiv="expires">
   
<title>3.7.18 transforms.inc</title>
 <link href="povray35.css" rel="stylesheet" type="text/css"> 
</head>
 <body> 
<table class="NavBar" width="100%">
  
 <tr>
   
  <td align="left" nowrap="" valign="middle" width="32">
    <a href="s_148.html"><img alt="previous" border="0" src="prev.png"></a> 
   
  </td>
   
  <td align="left" valign="middle" width="30%">
    <a href="s_148.html">3.7.17 textures.inc</a> 
  </td>
   
  <td align="center" valign="middle">
    <strong class="NavBar">POV-Ray 3.6 for UNIX documentation</strong><br> <strong>3.7.18 
   transforms.inc</strong> 
  </td>
   
  <td align="right" valign="middle" width="30%">
    <a href="s_150.html">3.7.19 woodmaps.inc, woods.inc</a> 
  </td>
   
  <td align="right" nowrap="" valign="middle" width="32">
    <a href="s_150.html"><img alt="next" border="0" src="next.png"></a> 
   
  </td>
   
 </tr>
  
</table>
 
<h3><a name="s03_07_18">3.7.18 </a>transforms.inc</h3>

<p>
  Several useful transformation macros. All these macros produce transformations, you can use them anywhere you can 
 use scale, rotate, etc. The descriptions will assume you are working with an object, but the macros will work fine for 
 textures, etc.<a name="s03_07_18_i1"><a name="Shear_Trans"></a> 
</p>

<p>
  <code>Shear_Trans(A, B, C)</code>. This macro reorients and deforms an object so its original XYZ axes point along 
 A, B, and C, resulting in a shearing effect when the vectors are not perpendicular. You can also use vectors of 
 different lengths to affect scaling, or use perpendicular vectors to reorient the object.<br> Parameters: 
</p>

<ul>
 
 <li>
   <code>A, B, C</code> = Vectors representing the new XYZ axes for the transformation. 
 </li>

</ul>
<a name="s03_07_18_i2"><a name="Matrix_Trans"></a>
<p>
  <code>Matrix_Trans(A, B, C, D)</code>. This macro provides a way to specify a matrix transform with 4 vectors. The 
 effects are very similar to that of the Shear_Trans() macro, but the fourth parameter controls translation.<br> 
 Parameters: 
</p>

<ul>
 
 <li>
   <code>A, B, C, D</code> = Vectors for each row of the resulting matrix. 
 </li>

</ul>
<a name="s03_07_18_i3"><a name="Axial_Scale_Trans"></a>
<p>
  <code>Axial_Scale_Trans(Axis, Amt)</code>. A kind of directional scale, this macro will &quot;stretch&quot; an 
 object along a specified axis.<br> Parameters: 
</p>

<ul>
 
 <li>
   <code>Axis</code> = A vector indicating the direction to stretch along. 
 </li>

 <li>
   Amt = The amount to stretch. 
 </li>

</ul>
<a name="s03_07_18_i4"><a name="Axis_Rotate_Trans"></a>
<p>
  <code>Axis_Rotate_Trans(Axis, Angle)</code>. This is equivalent to the transformation done by the vaxis_rotate() 
 function, it rotates around an arbitrary axis.<br> Parameters: 
</p>

<ul>
 
 <li>
   <code>Axis</code> = A vector representing the axis to rotate around. 
 </li>

 <li>
   <code>Angle</code> = The amount to rotate by. 
 </li>

</ul>
<a name="s03_07_18_i5"><a name="Rotate_Around_Trans"></a>
<p>
  <code>Rotate_Around_Trans(Rotation, Point)</code>. Ordinary rotation operates around the origin, this macro rotates 
 around a specific point.<br> Parameters: 
</p>

<ul>
 
 <li>
   <code>Rotation</code> = The rotation vector, the same as the parameter to the rotate keyword. 
 </li>

 <li>
   <code>Point</code> = The point to rotate around. 
 </li>

</ul>
<a name="s03_07_18_i6"><a name="Reorient_Trans"></a>
<p>
  <code>Reorient_Trans(Axis1, Axis2)</code>. This aligns <code>Axis1</code> to <code>Axis2</code> by rotating the 
 object around a vector perpendicular to both axis1 and axis2. <br>Parameters: 
</p>

<ul>
 
 <li>
   <code>Axis1</code> = Vector to be rotated. 
 </li>

 <li>
   <code>Axis2</code> = Vectors to be rotated towards. 
 </li>

</ul>
<a name="s03_07_18_i7"><a name="Point_At_Trans"></a>
<p>
  <code>Point_At_Trans(YAxis)</code>. This macro is similar to Reorient_Trans(), but it points the y axis along Axis.<br> 
 Parameters: 
</p>

<ul>
 
 <li>
   <code>YAxis</code> = The direction to point the y axis in. 
 </li>

</ul>
<a name="s03_07_18_i8"><a name="Center_Trans"></a>
<p>
  <code>Center_Trans(Object, Axis)</code>. Calculates a transformation which will center an object along a specified 
 axis. You indicate the axes you want to center along by adding &quot;x&quot;, &quot;y&quot;, and &quot;z&quot; 
 together in the Axis parameter. 
</p>

<p class="Note">
  <strong>Note:</strong> this macro actually computes the transform to center the bounding box of the 
 object, which may not be entirely accurate. There is no way to define the &quot;center&quot; of an arbitrary object. 
</p>

<p>
  Parameters: 
</p>

<ul>
 
 <li>
   <code>Object</code> = The object the center transform is being computed for. 
 </li>

 <li>
   <code>Axis</code> = The axes to center the object on. 
 </li>

</ul>

<p>
  Usage: 
</p>

<pre>
object {MyObj Center_Trans(MyObj, x)} //center along x axis
 </pre>

<p>
  You can also center along multiple axes: 
</p>

<pre>
object {MyObj Center_Trans(MyObj, x+y)} //center along x and y axis
 </pre>
<a name="s03_07_18_i9"><a name="Align_Trans"></a>
<p>
  <code>Align_Trans(Object, Axis, Pt)</code>. Calculates a transformation which will align the sides of the bounding 
 box of an object to a point. Negative values on Axis will align to the sides facing the negative ends of the 
 coordinate system, positive values will align to the opposite sides, 0 means not to do any alignment on that axis.<br> 
 Parameters: 
</p>

<ul>
 
 <li>
   <code>Object</code> = The object being aligned. 
 </li>

 <li>
   <code>Axis</code> = A combination of +x, +y, +z, -x, -y, and -z, or a vector where each component is -1, 0, or +1 
  specifying the faces of the bounding box to align to the point. 
 </li>

 <li>
   <code>Point</code> = The point to which to align the bounding box of the object. 
 </li>

</ul>

<p>
  Usage: 
</p>

<pre>
  object {
     MyObj 
     Align_Trans(MyObj, x, Pt) //Align right side of object to be
                               //coplanar with Pt
     Align_Trans(MyObj,-y, Pt) //Align bottom of object to be
                               // coplanar with Pt
  } 
 </pre>
<a name="s03_07_18_i10"><a name="vtransform"></a>
<p>
  <code>vtransform(Vect, Trans)</code> and <code>vinv_transform(Vect, Trans)</code>.<br> The <code>vtransform()</code> 
 macro takes a transformation (rotate, scale, translate, etc...) and a point, and returns the result of applying the 
 transformation to the point. The <code>vinv_transform()</code> macro is similar, but applies the inverse of the 
 transform, in effect &quot;undoing&quot; the transformation. You can combine transformations by enclosing them in a 
 transform block.<br> Parameters: 
</p>

<ul>
 
 <li>
   <code>Vect</code> = The vector to which to apply the transformation. 
 </li>

 <li>
   <code>Trans</code> = The transformation to apply to Vect. 
 </li>

</ul>
<a name="s03_07_18_i11"><a name="spline_trans"></a>
<p>
  <code>Spline_Trans(Spline, Time, SkyVector, ForeSight, Banking)</code>. This macro aligns an object to a spline for 
 a given time value. The Z axis of the object will point in the forward direction of the spline and the Y axis of the 
 object will point upwards.<br> Parameters: 
</p>

<ul>
 
 <li>
   <code>Spline</code> = The spline that the object is aligned to. 
 </li>

 <li>
   <code>Time</code> = The time value to feed to the spline, for example clock. 
 </li>

 <li>
   <code>Sky</code> = The vector that is upwards in your scene, usually y. 
 </li>

 <li>
   <code>Foresight</code> = A positive value that controls how much in advance the object will turn and bank. Values 
  close to 0 will give precise results, while higher values give smoother results. It will not affect parsing speed, so 
  just find the value that looks best. 
 </li>

 <li>
   <code>Banking</code> = How much the object tilts when turning. The amount of tilting is equally much controlled 
  by the ForeSight value. 
 </li>

</ul>

<p>
  Usage: 
</p>

<pre>
   object {MyObj Spline_Trans(MySpline, clock, y, 0.1, 0.5)}
</pre>
 <br> 
<table class="NavBar" width="100%">
  
 <tr>
   
  <td align="left" nowrap="" valign="middle" width="32">
    <a href="s_148.html"><img alt="previous" border="0" src="prev.png"></a> 
   
  </td>
   
  <td align="left" valign="middle" width="30%">
    <a href="s_148.html">3.7.17 textures.inc</a> 
  </td>
   
  <td align="center" valign="middle">
    <strong>3.7.18 transforms.inc</strong> 
  </td>
   
  <td align="right" valign="middle" width="30%">
    <a href="s_150.html">3.7.19 woodmaps.inc, woods.inc</a> 
  </td>
   
  <td align="right" nowrap="" valign="middle" width="32">
    <a href="s_150.html"><img alt="next" border="0" src="next.png"></a> 
   
  </td>
   
 </tr>
  
</table>
 </body> </html>