root/trunk/doc/basic.html

Revision 5, 8.8 kB (checked in by nail, 3 years ago)

Initial import

Line 
1 <html><head>
2 <meta http-equiv="content-type" content="text/html; charset=utf-8">
3 <meta content="text/javascript" http-equiv="content-script-type">
4 <title>helix.basic</title>
5 <link rel="stylesheet" type="text/css" href="candydoc/style.css">
6 <!--[if lt IE 7]><link rel="stylesheet" type="text/css" href="candydoc/ie56hack.css"><![endif]-->
7 <script language="JavaScript" src="candydoc/util.js" type="text/javascript"></script>
8 <script language="JavaScript" src="candydoc/tree.js" type="text/javascript"></script>
9 <script language="JavaScript" src="candydoc/explorer.js" type="text/javascript"></script>
10 </head><body>
11 <div id="tabarea"></div><div id="explorerclient"></div>
12 <div id="content"><script>explorer.initialize("helix.basic");</script>
13     <table class="content">
14         <tr><td id="docbody"><h1>helix.basic</h1><!-- Generated by Ddoc from c:\sdk\helix\trunk\helix\basic.d -->
15 Module provides basic numeric routines that are oftenly used in other
16 modules or helpful in projects that use helix.
17 <br><br>
18 <b>Authors:</b><br>
19 Victor Nakoryakov, nail-mail[at]mail.ru
20 <br><br>
21
22
23 <script>explorer.outline.incSymbolLevel();</script>
24 <dl>
25 <script>explorer.outline.writeEnabled = true;</script>
26 <dt><span class="decl">bit
27 <span class="currsymbol">equal</span>
28 <script>explorer.outline.addDecl('equal');</script>
29
30 (real <span class="funcparam">x</span>, real <span class="funcparam">y</span>, int <span class="funcparam">relprec</span> = 16, int <span class="funcparam">absprec</span> = 16);
31 </span></dt>
32 <script>explorer.outline.writeEnabled = false;</script>
33
34
35 <dd>Approximate equality function. In fact it's just a copy of phobos'es feqrel function,
36 but with modifcation that make it suitable for comparison of almost zero numbers.
37 However the cost of such possibility is little calculation overhead.
38 <br><br>
39 <b>Params:</b><br>
40 <table><tr>
41 <td nowrap valign="top" style="padding-right: 8px">int <span class="funcparam">relprec</span></td>
42
43                
44 <td>Minimal number of mantissa bits that have to be equal in <span class="funcparam">x</span> and <span class="funcparam">y</span>
45                   to suppose their's equality. Makes sense in comparisons of values
46                   enough far from zero.</td></tr>
47 <tr>
48 <td nowrap valign="top" style="padding-right: 8px">int <span class="funcparam">absprec</span></td>
49
50                
51 <td>If absolute difference between <span class="funcparam">x</span> and <span class="funcparam">y</span> is less than 2^(-<span class="funcparam">absprec</span>)
52                   they supposed to be equal. Makes sense in comparisons of values
53                   enough near to zero.</td></tr>
54 </table><br>
55 <b>Returns:</b><br>
56 <b>true</b> if <span class="funcparam">x</span> and <span class="funcparam">y</span> are supposed to be equal, <b>false</b> otherwise.
57 <br><br>
58
59 </dd>
60
61 <script>explorer.outline.writeEnabled = true;</script>
62 <dt><span class="decl">real
63 <span class="currsymbol">lerp</span>
64 <script>explorer.outline.addDecl('lerp');</script>
65
66 (real <span class="funcparam">a</span>, real <span class="funcparam">b</span>, real <span class="funcparam">t</span>);
67 </span></dt>
68 <script>explorer.outline.writeEnabled = false;</script>
69
70
71 <dd>Linear interpolation function.
72 <br><br>
73 <b>Returns:</b><br>
74 Value interpolated from <span class="funcparam">a</span> to <span class="funcparam">b</span> by value of <span class="funcparam">t</span>. If <span class="funcparam">t</span> is not within range [0; 1]
75     linear extrapolation is applied.
76 <br><br>
77
78 </dd>
79
80 <script>explorer.outline.writeEnabled = true;</script>
81 <dt><span class="decl">template
82 <span class="currsymbol">MinMax</span>
83 <script>explorer.outline.addDecl('MinMax');</script>
84
85 (T)</span></dt>
86 <script>explorer.outline.writeEnabled = false;</script>
87
88
89 <dd>Contains min and max functions for generic types that provide
90 opCmp.
91 <br><br>
92
93
94 <script>explorer.outline.incSymbolLevel();</script>
95 <dl>
96 <script>explorer.outline.writeEnabled = true;</script>
97 <dt><span class="decl">T
98 <span class="currsymbol">max</span>
99 <script>explorer.outline.addDecl('max');</script>
100
101 (T <span class="funcparam">a</span>, T <span class="funcparam">b</span>);
102 </span></dt>
103 <script>explorer.outline.writeEnabled = false;</script>
104
105
106 <dd><b>Returns:</b><br>
107 Maximal of <span class="funcparam">a</span> and <span class="funcparam">b</span>.
108    
109 <br><br>
110
111 </dd>
112
113 <script>explorer.outline.writeEnabled = true;</script>
114 <dt><span class="decl">T
115 <span class="currsymbol">min</span>
116 <script>explorer.outline.addDecl('min');</script>
117
118 (T <span class="funcparam">a</span>, T <span class="funcparam">b</span>);
119 </span></dt>
120 <script>explorer.outline.writeEnabled = false;</script>
121
122
123 <dd><b>Returns:</b><br>
124 Minimal of <span class="funcparam">a</span> and <span class="funcparam">b</span>.
125    
126 <br><br>
127
128 </dd>
129 </dl>
130 <script>explorer.outline.decSymbolLevel();</script>
131
132
133 </dd>
134
135 <script>explorer.outline.writeEnabled = true;</script>
136 <dt><span class="decl">template
137 <span class="currsymbol">Clamp</span>
138 <script>explorer.outline.addDecl('Clamp');</script>
139
140 (T)</span></dt>
141 <script>explorer.outline.writeEnabled = false;</script>
142
143
144 <dd>Contains clamping functions for generic types to which min and max
145 functions can be applied.
146 <br><br>
147
148
149 <script>explorer.outline.incSymbolLevel();</script>
150 <dl>
151 <script>explorer.outline.writeEnabled = true;</script>
152 <dt><span class="decl">T
153 <span class="currsymbol">clampBelow</span>
154 <script>explorer.outline.addDecl('clampBelow');</script>
155
156 (inout T <span class="funcparam">x</span>, T <span class="funcparam">inf</span>);
157 </span></dt>
158 <script>explorer.outline.writeEnabled = false;</script>
159
160
161 <dd>Makes value of <span class="funcparam">x</span> to be not less than <span class="funcparam">inf</span>. Method can change value of <span class="funcparam">x</span>.
162 <br><br>
163 <b>Returns:</b><br>
164 Copy of <span class="funcparam">x</span> after clamping is applied.
165    
166 <br><br>
167
168 </dd>
169
170 <script>explorer.outline.writeEnabled = true;</script>
171 <dt><span class="decl">T
172 <span class="currsymbol">clampAbove</span>
173 <script>explorer.outline.addDecl('clampAbove');</script>
174
175 (inout T <span class="funcparam">x</span>, T <span class="funcparam">sup</span>);
176 </span></dt>
177 <script>explorer.outline.writeEnabled = false;</script>
178
179
180 <dd>Makes value of <span class="funcparam">x</span> to be not greater than <span class="funcparam">sup</span>. Method can change value of <span class="funcparam">x</span>.
181 <br><br>
182 <b>Returns:</b><br>
183 Copy of <span class="funcparam">x</span> after clamping is applied.
184    
185 <br><br>
186
187 </dd>
188
189 <script>explorer.outline.writeEnabled = true;</script>
190 <dt><span class="decl">T
191 <span class="currsymbol">clamp</span>
192 <script>explorer.outline.addDecl('clamp');</script>
193
194 (inout T <span class="funcparam">x</span>, T <span class="funcparam">inf</span>, T <span class="funcparam">sup</span>);
195 </span></dt>
196 <script>explorer.outline.writeEnabled = false;</script>
197
198
199 <dd>Makes value of <span class="funcparam">x</span> to be nor less than <span class="funcparam">inf</span> nor greater than <span class="funcparam">sup</span>.
200     Method can change value of <span class="funcparam">x</span>.
201 <br><br>
202 <b>Returns:</b><br>
203 Copy of <span class="funcparam">x</span> after clamping is applied.
204    
205 <br><br>
206
207 </dd>
208 </dl>
209 <script>explorer.outline.decSymbolLevel();</script>
210
211
212 </dd>
213
214 <script>explorer.outline.writeEnabled = true;</script>
215 <dt><span class="decl">template
216 <span class="currsymbol">SimpleSwap</span>
217 <script>explorer.outline.addDecl('SimpleSwap');</script>
218
219 (T)</span></dt>
220 <script>explorer.outline.writeEnabled = false;</script>
221
222
223 <dd>Contains swap function for generic types.
224 <br><br>
225
226
227 <script>explorer.outline.incSymbolLevel();</script>
228 <dl>
229 <script>explorer.outline.writeEnabled = true;</script>
230 <dt><span class="decl">void
231 <span class="currsymbol">swap</span>
232 <script>explorer.outline.addDecl('swap');</script>
233
234 (inout T <span class="funcparam">a</span>, inout T <span class="funcparam">b</span>);
235 </span></dt>
236 <script>explorer.outline.writeEnabled = false;</script>
237
238
239 <dd>Swaps values of <span class="funcparam">a</span> and <span class="funcparam">b</span>.
240 <br><br>
241
242 </dd>
243 </dl>
244 <script>explorer.outline.decSymbolLevel();</script>
245
246
247 </dd>
248 </dl>
249 <script>explorer.outline.decSymbolLevel();</script>
250
251
252 </td></tr>
253         <tr><td id="docfooter">
254             Page was generated with
255             <img src="candydoc/img/candydoc.gif" style="vertical-align:middle; position:relative; top:-1px">
256             on Tue Feb 21 11:32:52 2006
257
258         </td></tr>
259     </table>
260 </div>
261 <script>
262     explorer.packageExplorer.addModule("helix.basic");
263     explorer.packageExplorer.addModule("helix.color");
264     explorer.packageExplorer.addModule("helix.config");
265     explorer.packageExplorer.addModule("helix.linalgebra");</script>
266 </body></html>
Note: See TracBrowser for help on using the browser.