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
|
<!-- 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.1 arrays.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_131.html"><img alt="previous" border="0" src="prev.png"></a>
</td>
<td align="left" valign="middle" width="30%">
<a href="s_131.html">3.7 Include Files</a>
</td>
<td align="center" valign="middle">
<strong class="NavBar">POV-Ray 3.6 for UNIX documentation</strong><br> <strong>3.7.1
arrays.inc</strong>
</td>
<td align="right" valign="middle" width="30%">
<a href="s_133.html">3.7.2 chars.inc</a>
</td>
<td align="right" nowrap="" valign="middle" width="32">
<a href="s_133.html"><img alt="next" border="0" src="next.png"></a>
</td>
</tr>
</table>
<h3><a name="s03_07_01">3.7.1 </a>arrays.inc</h3>
<p>
This file contains macros for manipulating arrays.<a name="s03_07_01_i1"><a name="Rand_Array_Item"></a>
</p>
<p>
<code>Rand_Array_Item(Array, Stream)</code>. Randomly Picks an item from a 1D array.<br> Parameters:
</p>
<ul>
<li>
<code>Array</code> = The array from which to choose the item.
</li>
<li>
<code>Stream</code> = A random number stream.
</li>
</ul>
<a name="s03_07_01_i2"><a name="Resize_Array"></a>
<p>
<code>Resize_Array(Array, NewSize)</code>. Resize a 1D array, retaining its contents.<br> Parameters:
</p>
<ul>
<li>
<code>Array</code> = The array to be resized.
</li>
<li>
<code>NewSize</code> = The desired new size of the array.
</li>
</ul>
<a name="s03_07_01_i3"><a name="Reverse_Array"></a>
<p>
<code>Reverse_Array(Array)</code>. Reverses the order of items in a 1D array.<br> Parameters:
</p>
<ul>
<li>
<code>Array</code> = The array to be reversed.
</li>
</ul>
<a name="s03_07_01_i4"><a name="Sort_Compare"></a>
<p>
<code>Sort_Compare(Array, IdxA, IdxB)</code>. This macro is used by the <code>Sort_Array()</code> and <code>Sort_Partial_Array()</code>
macros. The given macro works for 1D arrays of floats, but you can redefine it in your scene file for more complex
situations, arrays of vectors or multidimensional arrays for example. Just make sure your macro returns true if the
item at IdxA < the item at IdxB, and otherwise returns false.<br> Parameters:
</p>
<ul>
<li>
<code>Array</code> = The array containing the data being sorted.
</li>
<li>
<code>IdxA, IdxB</code> = The array offsets of the data elements being compared.
</li>
</ul>
<a name="s03_07_01_i5"><a name="Sort_Swap_Data"></a>
<p>
<code>Sort_Swap_Data(Array, IdxA, IdxB)</code>. This macro is used by the <code>Sort_Array()</code> and <code>Sort_Partial_Array()</code>
macros. The given macro works for 1D arrays only, but you can redefine it in your scene file to handle
multidimensional arrays if needed. The only requirement is that your macro swaps the data at IdxA with that at IdxB.<br>
Parameters:
</p>
<ul>
<li>
<code>Array</code> = The array containing the data being sorted.
</li>
<li>
<code>IdxA, IdxB</code> = The array offsets of the data elements being swapped.
</li>
</ul>
<a name="s03_07_01_i6"><a name="Sort_Array"></a>
<p>
<code>Sort_Array(Array)</code>. This macro sorts a 1D array of floats, though you can redefine the <code>Sort_Compare()</code>
and <code>Sort_Swap_Data()</code> macros to handle multidimensional arrays and other data types.<br> Parameters:
</p>
<ul>
<li>
<code>Array</code> = The array to be sorted.
</li>
</ul>
<a name="s03_07_01_i7"><a name="Sort_Partial_Array"></a>
<p>
<code>Sort_Partial_Array(Array, FirstInd, LastInd)</code>. This macro is like <code>Sort_Array()</code>, but sorts
a specific range of an array instead of the whole array.<br> Parameters:
</p>
<ul>
<li>
<code>Array</code> = The array to be sorted.
</li>
<li>
<code>FirstInd, LastInd</code> = The start and end indices of the range being sorted.
</li>
</ul>
<br>
<table class="NavBar" width="100%">
<tr>
<td align="left" nowrap="" valign="middle" width="32">
<a href="s_131.html"><img alt="previous" border="0" src="prev.png"></a>
</td>
<td align="left" valign="middle" width="30%">
<a href="s_131.html">3.7 Include Files</a>
</td>
<td align="center" valign="middle">
<strong>3.7.1 arrays.inc</strong>
</td>
<td align="right" valign="middle" width="30%">
<a href="s_133.html">3.7.2 chars.inc</a>
</td>
<td align="right" nowrap="" valign="middle" width="32">
<a href="s_133.html"><img alt="next" border="0" src="next.png"></a>
</td>
</tr>
</table>
</body> </html>
|