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
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
|
<html>
<head>
<title>NVIDIA(R) Blast(R) SDK 1.1 Source Reference: sdk/extensions/authoring/source/VHACD/inc/btScalar.h Source File</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<LINK HREF="NVIDIA.css" REL="stylesheet" TYPE="text/css">
</head>
<body bgcolor="#FFFFFF">
<div id="header">
<hr class="first">
<img alt="" src="blast_logo.png">
<br>
<center>
<a class="qindex" href="main.html">Main Page</a>
<!-- <a class="qindex" href="hierarchy.html">Class Hierarchy</a> //-->
<a class="qindex" href="annotated.html">Class List</a>
<a class="qindex" href="functions.html">Class Members</a>
</center>
<hr class="second">
</div>
<!-- Generated by Doxygen 1.5.8 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="main.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>User's Guide</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>File Members</span></a></li>
</ul>
</div>
<h1>sdk/extensions/authoring/source/VHACD/inc/btScalar.h</h1><a href="bt_scalar_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment">Copyright (c) 2003-2009 Erwin Coumans http://bullet.googlecode.com</span>
<a name="l00003"></a>00003 <span class="comment"></span>
<a name="l00004"></a>00004 <span class="comment">This software is provided 'as-is', without any express or implied warranty.</span>
<a name="l00005"></a>00005 <span class="comment">In no event will the authors be held liable for any damages arising from the use of this software.</span>
<a name="l00006"></a>00006 <span class="comment">Permission is granted to anyone to use this software for any purpose, </span>
<a name="l00007"></a>00007 <span class="comment">including commercial applications, and to alter it and redistribute it freely, </span>
<a name="l00008"></a>00008 <span class="comment">subject to the following restrictions:</span>
<a name="l00009"></a>00009 <span class="comment"></span>
<a name="l00010"></a>00010 <span class="comment">1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.</span>
<a name="l00011"></a>00011 <span class="comment">2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.</span>
<a name="l00012"></a>00012 <span class="comment">3. This notice may not be removed or altered from any source distribution.</span>
<a name="l00013"></a>00013 <span class="comment">*/</span>
<a name="l00014"></a>00014
<a name="l00015"></a>00015 <span class="preprocessor">#ifndef BT_SCALAR_H</span>
<a name="l00016"></a>00016 <span class="preprocessor"></span><span class="preprocessor">#define BT_SCALAR_H</span>
<a name="l00017"></a>00017 <span class="preprocessor"></span>
<a name="l00018"></a>00018 <span class="preprocessor">#ifdef BT_MANAGED_CODE</span>
<a name="l00019"></a>00019 <span class="preprocessor"></span><span class="comment">//Aligned data types not supported in managed code</span>
<a name="l00020"></a>00020 <span class="preprocessor">#pragma unmanaged</span>
<a name="l00021"></a>00021 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00022"></a>00022 <span class="preprocessor"></span>
<a name="l00023"></a>00023 <span class="preprocessor">#include <float.h></span>
<a name="l00024"></a>00024 <span class="preprocessor">#include <math.h></span>
<a name="l00025"></a>00025 <span class="preprocessor">#include <stdlib.h></span> <span class="comment">//size_t for MSVC 6.0</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include <stdint.h></span>
<a name="l00027"></a>00027
<a name="l00028"></a>00028 <span class="comment">/* SVN $Revision$ on $Date$ from http://bullet.googlecode.com*/</span>
<a name="l00029"></a><a class="code" href="bt_scalar_8h.html#cdcfe44a281881cbd298ecdee240ea46">00029</a> <span class="preprocessor">#define BT_BULLET_VERSION 279</span>
<a name="l00030"></a>00030 <span class="preprocessor"></span>
<a name="l00031"></a><a class="code" href="bt_scalar_8h.html#f25771f9443fab6ab8fcc9a0b78abce3">00031</a> <span class="keyword">inline</span> int32_t <a class="code" href="bt_scalar_8h.html#f25771f9443fab6ab8fcc9a0b78abce3">btGetVersion</a>()
<a name="l00032"></a>00032 {
<a name="l00033"></a>00033 <span class="keywordflow">return</span> <a class="code" href="bt_scalar_8h.html#cdcfe44a281881cbd298ecdee240ea46">BT_BULLET_VERSION</a>;
<a name="l00034"></a>00034 }
<a name="l00035"></a>00035
<a name="l00036"></a>00036 <span class="preprocessor">#if defined(DEBUG) || defined(_DEBUG)</span>
<a name="l00037"></a>00037 <span class="preprocessor"></span><span class="preprocessor">#define BT_DEBUG</span>
<a name="l00038"></a>00038 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00039"></a>00039 <span class="preprocessor"></span>
<a name="l00040"></a>00040 <span class="preprocessor">#ifdef _WIN32</span>
<a name="l00041"></a>00041 <span class="preprocessor"></span>
<a name="l00042"></a>00042 <span class="preprocessor">#if defined(__MINGW32__) || defined(__CYGWIN__) || (defined(_MSC_VER) && _MSC_VER < 1300)</span>
<a name="l00043"></a>00043 <span class="preprocessor"></span>
<a name="l00044"></a>00044 <span class="preprocessor">#define SIMD_FORCE_INLINE inline</span>
<a name="l00045"></a>00045 <span class="preprocessor"></span><span class="preprocessor">#define ATTRIBUTE_ALIGNED16(a) a</span>
<a name="l00046"></a>00046 <span class="preprocessor"></span><span class="preprocessor">#define ATTRIBUTE_ALIGNED64(a) a</span>
<a name="l00047"></a>00047 <span class="preprocessor"></span><span class="preprocessor">#define ATTRIBUTE_ALIGNED128(a) a</span>
<a name="l00048"></a>00048 <span class="preprocessor"></span><span class="preprocessor">#else</span>
<a name="l00049"></a>00049 <span class="preprocessor"></span><span class="comment">//#define BT_HAS_ALIGNED_ALLOCATOR</span>
<a name="l00050"></a>00050 <span class="preprocessor">#pragma warning(disable : 4324) // disable padding warning</span>
<a name="l00051"></a>00051 <span class="preprocessor"></span><span class="comment">// #pragma warning(disable:4530) // Disable the exception disable but used in MSCV Stl warning.</span>
<a name="l00052"></a>00052 <span class="comment">// #pragma warning(disable:4996) //Turn off warnings about deprecated C routines</span>
<a name="l00053"></a>00053 <span class="comment">// #pragma warning(disable:4786) // Disable the "debug name too long" warning</span>
<a name="l00054"></a>00054
<a name="l00055"></a>00055 <span class="preprocessor">#define SIMD_FORCE_INLINE __forceinline</span>
<a name="l00056"></a>00056 <span class="preprocessor"></span><span class="preprocessor">#define ATTRIBUTE_ALIGNED16(a) __declspec(align(16)) a</span>
<a name="l00057"></a>00057 <span class="preprocessor"></span><span class="preprocessor">#define ATTRIBUTE_ALIGNED64(a) __declspec(align(64)) a</span>
<a name="l00058"></a>00058 <span class="preprocessor"></span><span class="preprocessor">#define ATTRIBUTE_ALIGNED128(a) __declspec(align(128)) a</span>
<a name="l00059"></a>00059 <span class="preprocessor"></span><span class="preprocessor">#ifdef _XBOX</span>
<a name="l00060"></a>00060 <span class="preprocessor"></span><span class="preprocessor">#define BT_USE_VMX128</span>
<a name="l00061"></a>00061 <span class="preprocessor"></span>
<a name="l00062"></a>00062 <span class="preprocessor">#include <ppcintrinsics.h></span>
<a name="l00063"></a>00063 <span class="preprocessor">#define BT_HAVE_NATIVE_FSEL</span>
<a name="l00064"></a>00064 <span class="preprocessor"></span><span class="preprocessor">#define btFsel(a, b, c) __fsel((a), (b), (c))</span>
<a name="l00065"></a>00065 <span class="preprocessor"></span><span class="preprocessor">#else</span>
<a name="l00066"></a>00066 <span class="preprocessor"></span>
<a name="l00067"></a>00067 <span class="preprocessor">#if (defined(_WIN32) && (_MSC_VER) && _MSC_VER >= 1400) && (!defined(BT_USE_DOUBLE_PRECISION))</span>
<a name="l00068"></a>00068 <span class="preprocessor"></span><span class="preprocessor">#define BT_USE_SSE</span>
<a name="l00069"></a>00069 <span class="preprocessor"></span><span class="preprocessor">#include <emmintrin.h></span>
<a name="l00070"></a>00070 <span class="preprocessor">#endif</span>
<a name="l00071"></a>00071 <span class="preprocessor"></span>
<a name="l00072"></a>00072 <span class="preprocessor">#endif //_XBOX</span>
<a name="l00073"></a>00073 <span class="preprocessor"></span>
<a name="l00074"></a>00074 <span class="preprocessor">#endif //__MINGW32__</span>
<a name="l00075"></a>00075 <span class="preprocessor"></span>
<a name="l00076"></a>00076 <span class="preprocessor">#include <assert.h></span>
<a name="l00077"></a>00077 <span class="preprocessor">#ifdef BT_DEBUG</span>
<a name="l00078"></a>00078 <span class="preprocessor"></span><span class="preprocessor">#define btAssert assert</span>
<a name="l00079"></a>00079 <span class="preprocessor"></span><span class="preprocessor">#else</span>
<a name="l00080"></a>00080 <span class="preprocessor"></span><span class="preprocessor">#define btAssert(x)</span>
<a name="l00081"></a>00081 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00082"></a>00082 <span class="preprocessor"></span><span class="comment">//btFullAssert is optional, slows down a lot</span>
<a name="l00083"></a>00083 <span class="preprocessor">#define btFullAssert(x)</span>
<a name="l00084"></a>00084 <span class="preprocessor"></span>
<a name="l00085"></a>00085 <span class="preprocessor">#define btLikely(_c) _c</span>
<a name="l00086"></a>00086 <span class="preprocessor"></span><span class="preprocessor">#define btUnlikely(_c) _c</span>
<a name="l00087"></a>00087 <span class="preprocessor"></span>
<a name="l00088"></a>00088 <span class="preprocessor">#else</span>
<a name="l00089"></a>00089 <span class="preprocessor"></span>
<a name="l00090"></a>00090 <span class="preprocessor">#if defined(__CELLOS_LV2__)</span>
<a name="l00091"></a>00091 <span class="preprocessor"></span><span class="preprocessor">#define SIMD_FORCE_INLINE inline __attribute__((always_inline))</span>
<a name="l00092"></a>00092 <span class="preprocessor"></span><span class="preprocessor">#define ATTRIBUTE_ALIGNED16(a) a __attribute__((aligned(16)))</span>
<a name="l00093"></a>00093 <span class="preprocessor"></span><span class="preprocessor">#define ATTRIBUTE_ALIGNED64(a) a __attribute__((aligned(64)))</span>
<a name="l00094"></a>00094 <span class="preprocessor"></span><span class="preprocessor">#define ATTRIBUTE_ALIGNED128(a) a __attribute__((aligned(128)))</span>
<a name="l00095"></a>00095 <span class="preprocessor"></span><span class="preprocessor">#ifndef assert</span>
<a name="l00096"></a>00096 <span class="preprocessor"></span><span class="preprocessor">#include <assert.h></span>
<a name="l00097"></a>00097 <span class="preprocessor">#endif</span>
<a name="l00098"></a>00098 <span class="preprocessor"></span><span class="preprocessor">#ifdef BT_DEBUG</span>
<a name="l00099"></a>00099 <span class="preprocessor"></span><span class="preprocessor">#ifdef __SPU__</span>
<a name="l00100"></a>00100 <span class="preprocessor"></span><span class="preprocessor">#include <spu_printf.h></span>
<a name="l00101"></a>00101 <span class="preprocessor">#define printf spu_printf</span>
<a name="l00102"></a>00102 <span class="preprocessor"></span><span class="preprocessor">#define btAssert(x) \</span>
<a name="l00103"></a>00103 <span class="preprocessor"> { \</span>
<a name="l00104"></a>00104 <span class="preprocessor"> if (!(x)) { \</span>
<a name="l00105"></a>00105 <span class="preprocessor"> printf("Assert " __FILE__ ":%u (" #x ")\n", __LINE__); \</span>
<a name="l00106"></a>00106 <span class="preprocessor"> spu_hcmpeq(0, 0); \</span>
<a name="l00107"></a>00107 <span class="preprocessor"> } \</span>
<a name="l00108"></a>00108 <span class="preprocessor"> }</span>
<a name="l00109"></a>00109 <span class="preprocessor"></span><span class="preprocessor">#else</span>
<a name="l00110"></a>00110 <span class="preprocessor"></span><span class="preprocessor">#define btAssert assert</span>
<a name="l00111"></a>00111 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00112"></a>00112 <span class="preprocessor"></span>
<a name="l00113"></a>00113 <span class="preprocessor">#else</span>
<a name="l00114"></a>00114 <span class="preprocessor"></span><span class="preprocessor">#define btAssert(x)</span>
<a name="l00115"></a>00115 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00116"></a>00116 <span class="preprocessor"></span><span class="comment">//btFullAssert is optional, slows down a lot</span>
<a name="l00117"></a>00117 <span class="preprocessor">#define btFullAssert(x)</span>
<a name="l00118"></a>00118 <span class="preprocessor"></span>
<a name="l00119"></a>00119 <span class="preprocessor">#define btLikely(_c) _c</span>
<a name="l00120"></a>00120 <span class="preprocessor"></span><span class="preprocessor">#define btUnlikely(_c) _c</span>
<a name="l00121"></a>00121 <span class="preprocessor"></span>
<a name="l00122"></a>00122 <span class="preprocessor">#else</span>
<a name="l00123"></a>00123 <span class="preprocessor"></span>
<a name="l00124"></a>00124 <span class="preprocessor">#ifdef USE_LIBSPE2</span>
<a name="l00125"></a>00125 <span class="preprocessor"></span>
<a name="l00126"></a>00126 <span class="preprocessor">#define SIMD_FORCE_INLINE __inline</span>
<a name="l00127"></a>00127 <span class="preprocessor"></span><span class="preprocessor">#define ATTRIBUTE_ALIGNED16(a) a __attribute__((aligned(16)))</span>
<a name="l00128"></a>00128 <span class="preprocessor"></span><span class="preprocessor">#define ATTRIBUTE_ALIGNED64(a) a __attribute__((aligned(64)))</span>
<a name="l00129"></a>00129 <span class="preprocessor"></span><span class="preprocessor">#define ATTRIBUTE_ALIGNED128(a) a __attribute__((aligned(128)))</span>
<a name="l00130"></a>00130 <span class="preprocessor"></span><span class="preprocessor">#ifndef assert</span>
<a name="l00131"></a>00131 <span class="preprocessor"></span><span class="preprocessor">#include <assert.h></span>
<a name="l00132"></a>00132 <span class="preprocessor">#endif</span>
<a name="l00133"></a>00133 <span class="preprocessor"></span><span class="preprocessor">#ifdef BT_DEBUG</span>
<a name="l00134"></a>00134 <span class="preprocessor"></span><span class="preprocessor">#define btAssert assert</span>
<a name="l00135"></a>00135 <span class="preprocessor"></span><span class="preprocessor">#else</span>
<a name="l00136"></a>00136 <span class="preprocessor"></span><span class="preprocessor">#define btAssert(x)</span>
<a name="l00137"></a>00137 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00138"></a>00138 <span class="preprocessor"></span><span class="comment">//btFullAssert is optional, slows down a lot</span>
<a name="l00139"></a>00139 <span class="preprocessor">#define btFullAssert(x)</span>
<a name="l00140"></a>00140 <span class="preprocessor"></span>
<a name="l00141"></a>00141 <span class="preprocessor">#define btLikely(_c) __builtin_expect((_c), 1)</span>
<a name="l00142"></a>00142 <span class="preprocessor"></span><span class="preprocessor">#define btUnlikely(_c) __builtin_expect((_c), 0)</span>
<a name="l00143"></a>00143 <span class="preprocessor"></span>
<a name="l00144"></a>00144 <span class="preprocessor">#else</span>
<a name="l00145"></a>00145 <span class="preprocessor"></span><span class="comment">//non-windows systems</span>
<a name="l00146"></a>00146
<a name="l00147"></a>00147 <span class="preprocessor">#if (defined(__APPLE__) && defined(__i386__) && (!defined(BT_USE_DOUBLE_PRECISION)))</span>
<a name="l00148"></a>00148 <span class="preprocessor"></span><span class="preprocessor">#define BT_USE_SSE</span>
<a name="l00149"></a>00149 <span class="preprocessor"></span><span class="preprocessor">#include <emmintrin.h></span>
<a name="l00150"></a>00150
<a name="l00151"></a>00151 <span class="preprocessor">#define SIMD_FORCE_INLINE inline</span>
<a name="l00153"></a>00153 <span class="preprocessor">#define ATTRIBUTE_ALIGNED16(a) a __attribute__((aligned(16)))</span>
<a name="l00154"></a>00154 <span class="preprocessor"></span><span class="preprocessor">#define ATTRIBUTE_ALIGNED64(a) a __attribute__((aligned(64)))</span>
<a name="l00155"></a>00155 <span class="preprocessor"></span><span class="preprocessor">#define ATTRIBUTE_ALIGNED128(a) a __attribute__((aligned(128)))</span>
<a name="l00156"></a>00156 <span class="preprocessor"></span><span class="preprocessor">#ifndef assert</span>
<a name="l00157"></a>00157 <span class="preprocessor"></span><span class="preprocessor">#include <assert.h></span>
<a name="l00158"></a>00158 <span class="preprocessor">#endif</span>
<a name="l00159"></a>00159 <span class="preprocessor"></span>
<a name="l00160"></a>00160 <span class="preprocessor">#if defined(DEBUG) || defined(_DEBUG)</span>
<a name="l00161"></a>00161 <span class="preprocessor"></span><span class="preprocessor">#define btAssert assert</span>
<a name="l00162"></a>00162 <span class="preprocessor"></span><span class="preprocessor">#else</span>
<a name="l00163"></a>00163 <span class="preprocessor"></span><span class="preprocessor">#define btAssert(x)</span>
<a name="l00164"></a>00164 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00165"></a>00165 <span class="preprocessor"></span>
<a name="l00166"></a>00166 <span class="comment">//btFullAssert is optional, slows down a lot</span>
<a name="l00167"></a>00167 <span class="preprocessor">#define btFullAssert(x)</span>
<a name="l00168"></a>00168 <span class="preprocessor"></span><span class="preprocessor">#define btLikely(_c) _c</span>
<a name="l00169"></a>00169 <span class="preprocessor"></span><span class="preprocessor">#define btUnlikely(_c) _c</span>
<a name="l00170"></a>00170 <span class="preprocessor"></span>
<a name="l00171"></a>00171 <span class="preprocessor">#else</span>
<a name="l00172"></a>00172 <span class="preprocessor"></span>
<a name="l00173"></a><a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">00173</a> <span class="preprocessor">#define SIMD_FORCE_INLINE inline</span>
<a name="l00178"></a><a class="code" href="bt_scalar_8h.html#38c30fdd0ea2558373a1b6e41c77d9d2">00178</a> <span class="preprocessor">#define ATTRIBUTE_ALIGNED16(a) a</span>
<a name="l00179"></a><a class="code" href="bt_scalar_8h.html#f70e8b45dc0ad52b962f128ce45365dc">00179</a> <span class="preprocessor"></span><span class="preprocessor">#define ATTRIBUTE_ALIGNED64(a) a</span>
<a name="l00180"></a><a class="code" href="bt_scalar_8h.html#cb9392bc9b30095ec1ff9d98576b47e4">00180</a> <span class="preprocessor"></span><span class="preprocessor">#define ATTRIBUTE_ALIGNED128(a) a</span>
<a name="l00181"></a>00181 <span class="preprocessor"></span><span class="preprocessor">#ifndef assert</span>
<a name="l00182"></a>00182 <span class="preprocessor"></span><span class="preprocessor">#include <assert.h></span>
<a name="l00183"></a>00183 <span class="preprocessor">#endif</span>
<a name="l00184"></a>00184 <span class="preprocessor"></span>
<a name="l00185"></a>00185 <span class="preprocessor">#if defined(DEBUG) || defined(_DEBUG)</span>
<a name="l00186"></a>00186 <span class="preprocessor"></span><span class="preprocessor">#define btAssert assert</span>
<a name="l00187"></a>00187 <span class="preprocessor"></span><span class="preprocessor">#else</span>
<a name="l00188"></a><a class="code" href="bt_scalar_8h.html#ff3e6078c073f6ba0edb95353f2c2c62">00188</a> <span class="preprocessor"></span><span class="preprocessor">#define btAssert(x)</span>
<a name="l00189"></a>00189 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00190"></a>00190 <span class="preprocessor"></span>
<a name="l00191"></a>00191 <span class="comment">//btFullAssert is optional, slows down a lot</span>
<a name="l00192"></a><a class="code" href="bt_scalar_8h.html#90bc8c8b8f79211b2b7f0356c4cd804f">00192</a> <span class="preprocessor">#define btFullAssert(x)</span>
<a name="l00193"></a><a class="code" href="bt_scalar_8h.html#e9d26f737755d56d5374339f176a55ac">00193</a> <span class="preprocessor"></span><span class="preprocessor">#define btLikely(_c) _c</span>
<a name="l00194"></a><a class="code" href="bt_scalar_8h.html#75f41f19fd54104288141671ecf47427">00194</a> <span class="preprocessor"></span><span class="preprocessor">#define btUnlikely(_c) _c</span>
<a name="l00195"></a>00195 <span class="preprocessor"></span><span class="preprocessor">#endif //__APPLE__</span>
<a name="l00196"></a>00196 <span class="preprocessor"></span>
<a name="l00197"></a>00197 <span class="preprocessor">#endif // LIBSPE2</span>
<a name="l00198"></a>00198 <span class="preprocessor"></span>
<a name="l00199"></a>00199 <span class="preprocessor">#endif //__CELLOS_LV2__</span>
<a name="l00200"></a>00200 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00201"></a>00201 <span class="preprocessor"></span>
<a name="l00203"></a>00203 <span class="preprocessor">#if defined(BT_USE_DOUBLE_PRECISION)</span>
<a name="l00204"></a>00204 <span class="preprocessor"></span><span class="keyword">typedef</span> <span class="keywordtype">double</span> <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a>;
<a name="l00205"></a>00205 <span class="comment">//this number could be bigger in double precision</span>
<a name="l00206"></a>00206 <span class="preprocessor">#define BT_LARGE_FLOAT 1e30</span>
<a name="l00207"></a>00207 <span class="preprocessor"></span><span class="preprocessor">#else</span>
<a name="l00208"></a><a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018">00208</a> <span class="preprocessor"></span><span class="keyword">typedef</span> <span class="keywordtype">float</span> <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a>;
<a name="l00209"></a>00209 <span class="comment">//keep BT_LARGE_FLOAT*BT_LARGE_FLOAT < FLT_MAX</span>
<a name="l00210"></a><a class="code" href="bt_scalar_8h.html#3a24ecdd029d38fef175bee5d965710a">00210</a> <span class="preprocessor">#define BT_LARGE_FLOAT 1e18f</span>
<a name="l00211"></a>00211 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00212"></a>00212 <span class="preprocessor"></span>
<a name="l00213"></a><a class="code" href="bt_scalar_8h.html#0bd5b84db13a000ac43fffe2bfc32187">00213</a> <span class="preprocessor">#define BT_DECLARE_ALIGNED_ALLOCATOR() \</span>
<a name="l00214"></a>00214 <span class="preprocessor"> SIMD_FORCE_INLINE void* operator new(size_t sizeInBytes) { return btAlignedAlloc(sizeInBytes, 16); } \</span>
<a name="l00215"></a>00215 <span class="preprocessor"> SIMD_FORCE_INLINE void operator delete(void* ptr) { btAlignedFree(ptr); } \</span>
<a name="l00216"></a>00216 <span class="preprocessor"> SIMD_FORCE_INLINE void* operator new(size_t, void* ptr) { return ptr; } \</span>
<a name="l00217"></a>00217 <span class="preprocessor"> SIMD_FORCE_INLINE void operator delete(void*, void*) {} \</span>
<a name="l00218"></a>00218 <span class="preprocessor"> SIMD_FORCE_INLINE void* operator new[](size_t sizeInBytes) { return btAlignedAlloc(sizeInBytes, 16); } \</span>
<a name="l00219"></a>00219 <span class="preprocessor"> SIMD_FORCE_INLINE void operator delete[](void* ptr) { btAlignedFree(ptr); } \</span>
<a name="l00220"></a>00220 <span class="preprocessor"> SIMD_FORCE_INLINE void* operator new[](size_t, void* ptr) { return ptr; } \</span>
<a name="l00221"></a>00221 <span class="preprocessor"> SIMD_FORCE_INLINE void operator delete[](void*, void*) {}</span>
<a name="l00222"></a>00222 <span class="preprocessor"></span>
<a name="l00223"></a>00223 <span class="preprocessor">#if defined(BT_USE_DOUBLE_PRECISION) || defined(BT_FORCE_DOUBLE_FUNCTIONS)</span>
<a name="l00224"></a>00224 <span class="preprocessor"></span>
<a name="l00225"></a>00225 <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_scalar_8h.html#6b200a8d26a49406ca13329be909ec10">btSqrt</a>(<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_vector3_8h.html#0d05bb202a57e1c47ae0eeeec2502c1b" title="Return the x value.">x</a>)
<a name="l00226"></a>00226 {
<a name="l00227"></a>00227 <span class="keywordflow">return</span> sqrt(x);
<a name="l00228"></a>00228 }
<a name="l00229"></a>00229 <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_scalar_8h.html#4c4bd8e065ab617f4e37273d76e6d581">btFabs</a>(<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_vector3_8h.html#0d05bb202a57e1c47ae0eeeec2502c1b" title="Return the x value.">x</a>) { <span class="keywordflow">return</span> fabs(x); }
<a name="l00230"></a>00230 <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_scalar_8h.html#08cebf88560180c665f205810cc02d0f">btCos</a>(<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_vector3_8h.html#0d05bb202a57e1c47ae0eeeec2502c1b" title="Return the x value.">x</a>) { <span class="keywordflow">return</span> cos(x); }
<a name="l00231"></a>00231 <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_scalar_8h.html#21de15ec6359a37d7876fa26be384a4b">btSin</a>(<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_vector3_8h.html#0d05bb202a57e1c47ae0eeeec2502c1b" title="Return the x value.">x</a>) { <span class="keywordflow">return</span> sin(x); }
<a name="l00232"></a>00232 <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_scalar_8h.html#61eba4cb1055a482189cb096b93e0862">btTan</a>(<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_vector3_8h.html#0d05bb202a57e1c47ae0eeeec2502c1b" title="Return the x value.">x</a>) { <span class="keywordflow">return</span> tan(x); }
<a name="l00233"></a>00233 <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_scalar_8h.html#004c41de4028b1437d1aafbaa0769cd5">btAcos</a>(<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_vector3_8h.html#0d05bb202a57e1c47ae0eeeec2502c1b" title="Return the x value.">x</a>)
<a name="l00234"></a>00234 {
<a name="l00235"></a>00235 <span class="keywordflow">if</span> (x < <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a>(-1))
<a name="l00236"></a>00236 x = <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a>(-1);
<a name="l00237"></a>00237 <span class="keywordflow">if</span> (x > <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a>(1))
<a name="l00238"></a>00238 x = <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a>(1);
<a name="l00239"></a>00239 <span class="keywordflow">return</span> acos(x);
<a name="l00240"></a>00240 }
<a name="l00241"></a>00241 <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_scalar_8h.html#47baddce9fad101519c2a7456e2d6c9f">btAsin</a>(<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> x)
<a name="l00242"></a>00242 {
<a name="l00243"></a>00243 <span class="keywordflow">if</span> (x < <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a>(-1))
<a name="l00244"></a>00244 x = <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a>(-1);
<a name="l00245"></a>00245 <span class="keywordflow">if</span> (x > <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a>(1))
<a name="l00246"></a>00246 x = <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a>(1);
<a name="l00247"></a>00247 <span class="keywordflow">return</span> asin(x);
<a name="l00248"></a>00248 }
<a name="l00249"></a>00249 <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_scalar_8h.html#92ffb99031b0c2c191ce69400c620bd0">btAtan</a>(<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> x) { <span class="keywordflow">return</span> atan(x); }
<a name="l00250"></a>00250 <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_scalar_8h.html#c7d89f182c6f2997f9a50fe963f6f986">btAtan2</a>(<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> x, <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_vector3_8h.html#88617d2888b444b2ad2384b17b0eeadf" title="Return the y value.">y</a>) { <span class="keywordflow">return</span> atan2(x, y); }
<a name="l00251"></a>00251 <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_scalar_8h.html#95a570162190c25ed6d54b719f4f617b">btExp</a>(<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> x) { <span class="keywordflow">return</span> exp(x); }
<a name="l00252"></a>00252 <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_scalar_8h.html#8192288b73d65bcbc66d9e5f05a1b346">btLog</a>(<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> x) { <span class="keywordflow">return</span> log(x); }
<a name="l00253"></a>00253 <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_scalar_8h.html#fb9af7ad85bcd92acfd2bd813b706ae6">btPow</a>(<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> x, <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_vector3_8h.html#88617d2888b444b2ad2384b17b0eeadf" title="Return the y value.">y</a>) { <span class="keywordflow">return</span> pow(x, y); }
<a name="l00254"></a>00254 <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_scalar_8h.html#e7ebb0f0f37c7851cf64cdae2075ca2f">btFmod</a>(<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> x, <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_vector3_8h.html#88617d2888b444b2ad2384b17b0eeadf" title="Return the y value.">y</a>) { <span class="keywordflow">return</span> fmod(x, y); }
<a name="l00255"></a>00255
<a name="l00256"></a>00256 <span class="preprocessor">#else</span>
<a name="l00257"></a>00257 <span class="preprocessor"></span>
<a name="l00258"></a><a class="code" href="bt_scalar_8h.html#6b200a8d26a49406ca13329be909ec10">00258</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_scalar_8h.html#6b200a8d26a49406ca13329be909ec10">btSqrt</a>(<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_vector3_8h.html#88617d2888b444b2ad2384b17b0eeadf" title="Return the y value.">y</a>)
<a name="l00259"></a>00259 {
<a name="l00260"></a>00260 <span class="preprocessor">#ifdef USE_APPROXIMATION</span>
<a name="l00261"></a>00261 <span class="preprocessor"></span> <span class="keywordtype">double</span> x, <a class="code" href="bt_vector3_8h.html#49dd8d4770be4de32dd57f9b926aa396" title="Return the z value.">z</a>, tempf;
<a name="l00262"></a>00262 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>* tfptr = ((<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>*)&tempf) + 1;
<a name="l00263"></a>00263
<a name="l00264"></a>00264 tempf = y;
<a name="l00265"></a>00265 *tfptr = (0xbfcdd90a - *tfptr) >> 1; <span class="comment">/* estimate of 1/sqrt(y) */</span>
<a name="l00266"></a>00266 x = tempf;
<a name="l00267"></a>00267 z = y * <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a>(0.5);
<a name="l00268"></a>00268 x = (<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a>(1.5) * x) - (x * x) * (x * z); <span class="comment">/* iteration formula */</span>
<a name="l00269"></a>00269 x = (<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a>(1.5) * x) - (x * x) * (x * z);
<a name="l00270"></a>00270 x = (<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a>(1.5) * x) - (x * x) * (x * z);
<a name="l00271"></a>00271 x = (<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a>(1.5) * x) - (x * x) * (x * z);
<a name="l00272"></a>00272 x = (<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a>(1.5) * x) - (x * x) * (x * z);
<a name="l00273"></a>00273 <span class="keywordflow">return</span> x * y;
<a name="l00274"></a>00274 <span class="preprocessor">#else</span>
<a name="l00275"></a>00275 <span class="preprocessor"></span> <span class="keywordflow">return</span> sqrtf(y);
<a name="l00276"></a>00276 <span class="preprocessor">#endif</span>
<a name="l00277"></a>00277 <span class="preprocessor"></span>}
<a name="l00278"></a><a class="code" href="bt_scalar_8h.html#4c4bd8e065ab617f4e37273d76e6d581">00278</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_scalar_8h.html#4c4bd8e065ab617f4e37273d76e6d581">btFabs</a>(<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> x) { <span class="keywordflow">return</span> fabsf(x); }
<a name="l00279"></a><a class="code" href="bt_scalar_8h.html#08cebf88560180c665f205810cc02d0f">00279</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_scalar_8h.html#08cebf88560180c665f205810cc02d0f">btCos</a>(<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> x) { <span class="keywordflow">return</span> cosf(x); }
<a name="l00280"></a><a class="code" href="bt_scalar_8h.html#21de15ec6359a37d7876fa26be384a4b">00280</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_scalar_8h.html#21de15ec6359a37d7876fa26be384a4b">btSin</a>(<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> x) { <span class="keywordflow">return</span> sinf(x); }
<a name="l00281"></a><a class="code" href="bt_scalar_8h.html#61eba4cb1055a482189cb096b93e0862">00281</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_scalar_8h.html#61eba4cb1055a482189cb096b93e0862">btTan</a>(<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> x) { <span class="keywordflow">return</span> tanf(x); }
<a name="l00282"></a><a class="code" href="bt_scalar_8h.html#004c41de4028b1437d1aafbaa0769cd5">00282</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_scalar_8h.html#004c41de4028b1437d1aafbaa0769cd5">btAcos</a>(<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> x)
<a name="l00283"></a>00283 {
<a name="l00284"></a>00284 <span class="keywordflow">if</span> (x < <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a>(-1))
<a name="l00285"></a>00285 x = <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a>(-1);
<a name="l00286"></a>00286 <span class="keywordflow">if</span> (x > <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a>(1))
<a name="l00287"></a>00287 x = <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a>(1);
<a name="l00288"></a>00288 <span class="keywordflow">return</span> acosf(x);
<a name="l00289"></a>00289 }
<a name="l00290"></a><a class="code" href="bt_scalar_8h.html#47baddce9fad101519c2a7456e2d6c9f">00290</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_scalar_8h.html#47baddce9fad101519c2a7456e2d6c9f">btAsin</a>(<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> x)
<a name="l00291"></a>00291 {
<a name="l00292"></a>00292 <span class="keywordflow">if</span> (x < <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a>(-1))
<a name="l00293"></a>00293 x = <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a>(-1);
<a name="l00294"></a>00294 <span class="keywordflow">if</span> (x > <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a>(1))
<a name="l00295"></a>00295 x = <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a>(1);
<a name="l00296"></a>00296 <span class="keywordflow">return</span> asinf(x);
<a name="l00297"></a>00297 }
<a name="l00298"></a><a class="code" href="bt_scalar_8h.html#92ffb99031b0c2c191ce69400c620bd0">00298</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_scalar_8h.html#92ffb99031b0c2c191ce69400c620bd0">btAtan</a>(<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> x) { <span class="keywordflow">return</span> atanf(x); }
<a name="l00299"></a><a class="code" href="bt_scalar_8h.html#c7d89f182c6f2997f9a50fe963f6f986">00299</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_scalar_8h.html#c7d89f182c6f2997f9a50fe963f6f986">btAtan2</a>(<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> x, <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_vector3_8h.html#88617d2888b444b2ad2384b17b0eeadf" title="Return the y value.">y</a>) { <span class="keywordflow">return</span> atan2f(x, y); }
<a name="l00300"></a><a class="code" href="bt_scalar_8h.html#95a570162190c25ed6d54b719f4f617b">00300</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_scalar_8h.html#95a570162190c25ed6d54b719f4f617b">btExp</a>(<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> x) { <span class="keywordflow">return</span> expf(x); }
<a name="l00301"></a><a class="code" href="bt_scalar_8h.html#8192288b73d65bcbc66d9e5f05a1b346">00301</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_scalar_8h.html#8192288b73d65bcbc66d9e5f05a1b346">btLog</a>(<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> x) { <span class="keywordflow">return</span> logf(x); }
<a name="l00302"></a><a class="code" href="bt_scalar_8h.html#fb9af7ad85bcd92acfd2bd813b706ae6">00302</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_scalar_8h.html#fb9af7ad85bcd92acfd2bd813b706ae6">btPow</a>(<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> x, <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_vector3_8h.html#88617d2888b444b2ad2384b17b0eeadf" title="Return the y value.">y</a>) { <span class="keywordflow">return</span> powf(x, y); }
<a name="l00303"></a><a class="code" href="bt_scalar_8h.html#e7ebb0f0f37c7851cf64cdae2075ca2f">00303</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_scalar_8h.html#e7ebb0f0f37c7851cf64cdae2075ca2f">btFmod</a>(<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> x, <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_vector3_8h.html#88617d2888b444b2ad2384b17b0eeadf" title="Return the y value.">y</a>) { <span class="keywordflow">return</span> fmodf(x, y); }
<a name="l00304"></a>00304
<a name="l00305"></a>00305 <span class="preprocessor">#endif</span>
<a name="l00306"></a>00306 <span class="preprocessor"></span>
<a name="l00307"></a><a class="code" href="bt_scalar_8h.html#fa3dad5a5edb29663834714c0ef492bb">00307</a> <span class="preprocessor">#define SIMD_2_PI btScalar(6.283185307179586232)</span>
<a name="l00308"></a><a class="code" href="bt_scalar_8h.html#1bdff187c878167505bcedbbbabf7b0a">00308</a> <span class="preprocessor"></span><span class="preprocessor">#define SIMD_PI (SIMD_2_PI * btScalar(0.5))</span>
<a name="l00309"></a><a class="code" href="bt_scalar_8h.html#f451c843c6b96c5ce1fa0d1c39f4c255">00309</a> <span class="preprocessor"></span><span class="preprocessor">#define SIMD_HALF_PI (SIMD_2_PI * btScalar(0.25))</span>
<a name="l00310"></a><a class="code" href="bt_scalar_8h.html#0bec5e0f836008c100e66bddc0dc464d">00310</a> <span class="preprocessor"></span><span class="preprocessor">#define SIMD_RADS_PER_DEG (SIMD_2_PI / btScalar(360.0))</span>
<a name="l00311"></a><a class="code" href="bt_scalar_8h.html#3f5619d3b313715b716a938afe47207d">00311</a> <span class="preprocessor"></span><span class="preprocessor">#define SIMD_DEGS_PER_RAD (btScalar(360.0) / SIMD_2_PI)</span>
<a name="l00312"></a><a class="code" href="bt_scalar_8h.html#568883327ba96f54afed8dfd7ec1c66e">00312</a> <span class="preprocessor"></span><span class="preprocessor">#define SIMDSQRT12 btScalar(0.7071067811865475244008443621048490)</span>
<a name="l00313"></a>00313 <span class="preprocessor"></span>
<a name="l00314"></a><a class="code" href="bt_scalar_8h.html#3103b9da34215c512d7fbff3cd94dd60">00314</a> <span class="preprocessor">#define btRecipSqrt(x) ((btScalar)(btScalar(1.0) / btSqrt(btScalar(x)))) </span><span class="comment">/* reciprocal square root */</span>
<a name="l00315"></a>00315
<a name="l00316"></a>00316 <span class="preprocessor">#ifdef BT_USE_DOUBLE_PRECISION</span>
<a name="l00317"></a>00317 <span class="preprocessor"></span><span class="preprocessor">#define SIMD_EPSILON DBL_EPSILON</span>
<a name="l00318"></a>00318 <span class="preprocessor"></span><span class="preprocessor">#define SIMD_INFINITY DBL_MAX</span>
<a name="l00319"></a>00319 <span class="preprocessor"></span><span class="preprocessor">#else</span>
<a name="l00320"></a><a class="code" href="bt_scalar_8h.html#e51eef6845bd59f964c1b2dbfe7054b7">00320</a> <span class="preprocessor"></span><span class="preprocessor">#define SIMD_EPSILON FLT_EPSILON</span>
<a name="l00321"></a><a class="code" href="bt_scalar_8h.html#87dcd463392e45ddb5350989e566f34a">00321</a> <span class="preprocessor"></span><span class="preprocessor">#define SIMD_INFINITY FLT_MAX</span>
<a name="l00322"></a>00322 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00323"></a>00323 <span class="preprocessor"></span>
<a name="l00324"></a><a class="code" href="bt_scalar_8h.html#66aac39acce2b5c6d043d390f3ef4d4f">00324</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_scalar_8h.html#66aac39acce2b5c6d043d390f3ef4d4f">btAtan2Fast</a>(<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_vector3_8h.html#88617d2888b444b2ad2384b17b0eeadf" title="Return the y value.">y</a>, <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> x)
<a name="l00325"></a>00325 {
<a name="l00326"></a>00326 <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> coeff_1 = <a class="code" href="bt_scalar_8h.html#1bdff187c878167505bcedbbbabf7b0a">SIMD_PI</a> / 4.0f;
<a name="l00327"></a>00327 <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> coeff_2 = 3.0f * coeff_1;
<a name="l00328"></a>00328 <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> abs_y = <a class="code" href="bt_scalar_8h.html#4c4bd8e065ab617f4e37273d76e6d581">btFabs</a>(y);
<a name="l00329"></a>00329 <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_vector3_8h.html#9fc74450b4146c1a60a3bd6ba3bb23a4" title="Return the angle between this and another vector.">angle</a>;
<a name="l00330"></a>00330 <span class="keywordflow">if</span> (x >= 0.0f) {
<a name="l00331"></a>00331 <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> r = (x - abs_y) / (x + abs_y);
<a name="l00332"></a>00332 angle = coeff_1 - coeff_1 * r;
<a name="l00333"></a>00333 }
<a name="l00334"></a>00334 <span class="keywordflow">else</span> {
<a name="l00335"></a>00335 <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> r = (x + abs_y) / (abs_y - x);
<a name="l00336"></a>00336 angle = coeff_2 - coeff_1 * r;
<a name="l00337"></a>00337 }
<a name="l00338"></a>00338 <span class="keywordflow">return</span> (y < 0.0f) ? -angle : angle;
<a name="l00339"></a>00339 }
<a name="l00340"></a>00340
<a name="l00341"></a><a class="code" href="bt_scalar_8h.html#64883187cf63c81ef5fb15f6f0c7ae05">00341</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <span class="keywordtype">bool</span> <a class="code" href="bt_scalar_8h.html#64883187cf63c81ef5fb15f6f0c7ae05">btFuzzyZero</a>(<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> x) { <span class="keywordflow">return</span> <a class="code" href="bt_scalar_8h.html#4c4bd8e065ab617f4e37273d76e6d581">btFabs</a>(x) < <a class="code" href="bt_scalar_8h.html#e51eef6845bd59f964c1b2dbfe7054b7">SIMD_EPSILON</a>; }
<a name="l00342"></a>00342
<a name="l00343"></a><a class="code" href="bt_scalar_8h.html#06a781aa5e366e7e0c434e071a149215">00343</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <span class="keywordtype">bool</span> <a class="code" href="bt_scalar_8h.html#06a781aa5e366e7e0c434e071a149215">btEqual</a>(<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> a, <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> eps)
<a name="l00344"></a>00344 {
<a name="l00345"></a>00345 <span class="keywordflow">return</span> (((a) <= eps) && !((a) < -eps));
<a name="l00346"></a>00346 }
<a name="l00347"></a><a class="code" href="bt_scalar_8h.html#6aa33f13609b0c21f7ee3c27abf4b0e6">00347</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <span class="keywordtype">bool</span> <a class="code" href="bt_scalar_8h.html#6aa33f13609b0c21f7ee3c27abf4b0e6">btGreaterEqual</a>(<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> a, <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> eps)
<a name="l00348"></a>00348 {
<a name="l00349"></a>00349 <span class="keywordflow">return</span> (!((a) <= eps));
<a name="l00350"></a>00350 }
<a name="l00351"></a>00351
<a name="l00352"></a><a class="code" href="bt_scalar_8h.html#3feafcddd4c61e81aabd36c098953eaa">00352</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> int32_t <a class="code" href="bt_scalar_8h.html#3feafcddd4c61e81aabd36c098953eaa">btIsNegative</a>(<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> x)
<a name="l00353"></a>00353 {
<a name="l00354"></a>00354 <span class="keywordflow">return</span> x < <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a>(0.0) ? 1 : 0;
<a name="l00355"></a>00355 }
<a name="l00356"></a>00356
<a name="l00357"></a><a class="code" href="bt_scalar_8h.html#8fc2a728bab313f80f38c27508fef2cc">00357</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_scalar_8h.html#8fc2a728bab313f80f38c27508fef2cc">btRadians</a>(<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> x) { <span class="keywordflow">return</span> x * <a class="code" href="bt_scalar_8h.html#0bec5e0f836008c100e66bddc0dc464d">SIMD_RADS_PER_DEG</a>; }
<a name="l00358"></a><a class="code" href="bt_scalar_8h.html#62ae1d5b53ca14238715ed7a1a483aea">00358</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_scalar_8h.html#62ae1d5b53ca14238715ed7a1a483aea">btDegrees</a>(<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> x) { <span class="keywordflow">return</span> x * <a class="code" href="bt_scalar_8h.html#3f5619d3b313715b716a938afe47207d">SIMD_DEGS_PER_RAD</a>; }
<a name="l00359"></a>00359
<a name="l00360"></a><a class="code" href="bt_scalar_8h.html#358fff092c05693d8351cef9e9dae9a7">00360</a> <span class="preprocessor">#define BT_DECLARE_HANDLE(name) \</span>
<a name="l00361"></a>00361 <span class="preprocessor"> typedef struct name##__ { \</span>
<a name="l00362"></a>00362 <span class="preprocessor"> int32_t unused; \</span>
<a name="l00363"></a>00363 <span class="preprocessor"> } * name</span>
<a name="l00364"></a>00364 <span class="preprocessor"></span>
<a name="l00365"></a>00365 <span class="preprocessor">#ifndef btFsel</span>
<a name="l00366"></a><a class="code" href="bt_scalar_8h.html#a7bb31b9cab5f27d555f039f957ce4f3">00366</a> <span class="preprocessor"></span><a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_scalar_8h.html#a7bb31b9cab5f27d555f039f957ce4f3">btFsel</a>(<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> a, <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> b, <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> c)
<a name="l00367"></a>00367 {
<a name="l00368"></a>00368 <span class="keywordflow">return</span> a >= 0 ? b : c;
<a name="l00369"></a>00369 }
<a name="l00370"></a>00370 <span class="preprocessor">#endif</span>
<a name="l00371"></a><a class="code" href="bt_scalar_8h.html#cb1bcde16483d0a21f71ac4fe1c334be">00371</a> <span class="preprocessor"></span><span class="preprocessor">#define btFsels(a, b, c) (btScalar) btFsel(a, b, c)</span>
<a name="l00372"></a>00372 <span class="preprocessor"></span>
<a name="l00373"></a><a class="code" href="bt_scalar_8h.html#c1da8e69f1dad68053601dbfee8b3c60">00373</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <span class="keywordtype">bool</span> <a class="code" href="bt_scalar_8h.html#c1da8e69f1dad68053601dbfee8b3c60">btMachineIsLittleEndian</a>()
<a name="l00374"></a>00374 {
<a name="l00375"></a>00375 <span class="keywordtype">long</span> <span class="keywordtype">int</span> i = 1;
<a name="l00376"></a>00376 <span class="keyword">const</span> <span class="keywordtype">char</span>* p = (<span class="keyword">const</span> <span class="keywordtype">char</span>*)&i;
<a name="l00377"></a>00377 <span class="keywordflow">if</span> (p[0] == 1) <span class="comment">// Lowest address contains the least significant byte</span>
<a name="l00378"></a>00378 <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00379"></a>00379 <span class="keywordflow">else</span>
<a name="l00380"></a>00380 <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00381"></a>00381 }
<a name="l00382"></a>00382
<a name="l00385"></a><a class="code" href="bt_scalar_8h.html#1e6b7e4fdd9e5402805e4da711f96af0">00385</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <span class="keywordtype">unsigned</span> <a class="code" href="bt_scalar_8h.html#1e6b7e4fdd9e5402805e4da711f96af0">btSelect</a>(<span class="keywordtype">unsigned</span> condition, <span class="keywordtype">unsigned</span> valueIfConditionNonZero, <span class="keywordtype">unsigned</span> valueIfConditionZero)
<a name="l00386"></a>00386 {
<a name="l00387"></a>00387 <span class="comment">// Set testNz to 0xFFFFFFFF if condition is nonzero, 0x00000000 if condition is zero</span>
<a name="l00388"></a>00388 <span class="comment">// Rely on positive value or'ed with its negative having sign bit on</span>
<a name="l00389"></a>00389 <span class="comment">// and zero value or'ed with its negative (which is still zero) having sign bit off</span>
<a name="l00390"></a>00390 <span class="comment">// Use arithmetic shift right, shifting the sign bit through all 32 bits</span>
<a name="l00391"></a>00391 <span class="keywordtype">unsigned</span> testNz = (unsigned)(((int32_t)condition | -(int32_t)condition) >> 31);
<a name="l00392"></a>00392 <span class="keywordtype">unsigned</span> testEqz = ~testNz;
<a name="l00393"></a>00393 <span class="keywordflow">return</span> ((valueIfConditionNonZero & testNz) | (valueIfConditionZero & testEqz));
<a name="l00394"></a>00394 }
<a name="l00395"></a><a class="code" href="bt_scalar_8h.html#ef88ac3279b66587efd1fc594ec4c740">00395</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> int32_t <a class="code" href="bt_scalar_8h.html#1e6b7e4fdd9e5402805e4da711f96af0">btSelect</a>(<span class="keywordtype">unsigned</span> condition, int32_t valueIfConditionNonZero, int32_t valueIfConditionZero)
<a name="l00396"></a>00396 {
<a name="l00397"></a>00397 <span class="keywordtype">unsigned</span> testNz = (unsigned)(((int32_t)condition | -(int32_t)condition) >> 31);
<a name="l00398"></a>00398 <span class="keywordtype">unsigned</span> testEqz = ~testNz;
<a name="l00399"></a>00399 <span class="keywordflow">return</span> <span class="keyword">static_cast<</span>int32_t<span class="keyword">></span>((valueIfConditionNonZero & testNz) | (valueIfConditionZero & testEqz));
<a name="l00400"></a>00400 }
<a name="l00401"></a><a class="code" href="bt_scalar_8h.html#17fb72058bc8ff21cac791c87c8afc52">00401</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <span class="keywordtype">float</span> <a class="code" href="bt_scalar_8h.html#1e6b7e4fdd9e5402805e4da711f96af0">btSelect</a>(<span class="keywordtype">unsigned</span> condition, <span class="keywordtype">float</span> valueIfConditionNonZero, <span class="keywordtype">float</span> valueIfConditionZero)
<a name="l00402"></a>00402 {
<a name="l00403"></a>00403 <span class="preprocessor">#ifdef BT_HAVE_NATIVE_FSEL</span>
<a name="l00404"></a>00404 <span class="preprocessor"></span> <span class="keywordflow">return</span> (<span class="keywordtype">float</span>)<a class="code" href="bt_scalar_8h.html#a7bb31b9cab5f27d555f039f957ce4f3">btFsel</a>((<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a>)condition - <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a>(1.0f), valueIfConditionNonZero, valueIfConditionZero);
<a name="l00405"></a>00405 <span class="preprocessor">#else</span>
<a name="l00406"></a>00406 <span class="preprocessor"></span> <span class="keywordflow">return</span> (condition != 0) ? valueIfConditionNonZero : valueIfConditionZero;
<a name="l00407"></a>00407 <span class="preprocessor">#endif</span>
<a name="l00408"></a>00408 <span class="preprocessor"></span>}
<a name="l00409"></a>00409
<a name="l00410"></a>00410 <span class="keyword">template</span> <<span class="keyword">typename</span> T>
<a name="l00411"></a><a class="code" href="bt_scalar_8h.html#2914d44e9957536703eda13dd0a4a2b2">00411</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <span class="keywordtype">void</span> <a class="code" href="bt_scalar_8h.html#2914d44e9957536703eda13dd0a4a2b2">btSwap</a>(T& a, T& b)
<a name="l00412"></a>00412 {
<a name="l00413"></a>00413 T tmp = a;
<a name="l00414"></a>00414 a = b;
<a name="l00415"></a>00415 b = tmp;
<a name="l00416"></a>00416 }
<a name="l00417"></a>00417
<a name="l00418"></a>00418 <span class="comment">//PCK: endian swapping functions</span>
<a name="l00419"></a><a class="code" href="bt_scalar_8h.html#21b4d7889e86774c7f56b4a9da21e4f9">00419</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <span class="keywordtype">unsigned</span> <a class="code" href="bt_scalar_8h.html#21b4d7889e86774c7f56b4a9da21e4f9">btSwapEndian</a>(<span class="keywordtype">unsigned</span> val)
<a name="l00420"></a>00420 {
<a name="l00421"></a>00421 <span class="keywordflow">return</span> (((val & 0xff000000) >> 24) | ((val & 0x00ff0000) >> 8) | ((val & 0x0000ff00) << 8) | ((val & 0x000000ff) << 24));
<a name="l00422"></a>00422 }
<a name="l00423"></a>00423
<a name="l00424"></a><a class="code" href="bt_scalar_8h.html#62f53958f838c392ff106c83deb50933">00424</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> <a class="code" href="bt_scalar_8h.html#21b4d7889e86774c7f56b4a9da21e4f9">btSwapEndian</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> val)
<a name="l00425"></a>00425 {
<a name="l00426"></a>00426 <span class="keywordflow">return</span> <span class="keyword">static_cast<</span><span class="keywordtype">unsigned</span> <span class="keywordtype">short</span><span class="keyword">></span>(((val & 0xff00) >> 8) | ((val & 0x00ff) << 8));
<a name="l00427"></a>00427 }
<a name="l00428"></a>00428
<a name="l00429"></a><a class="code" href="bt_scalar_8h.html#4bf92f546517c647cf87ae6e476ec733">00429</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <span class="keywordtype">unsigned</span> <a class="code" href="bt_scalar_8h.html#21b4d7889e86774c7f56b4a9da21e4f9">btSwapEndian</a>(int32_t val)
<a name="l00430"></a>00430 {
<a name="l00431"></a>00431 <span class="keywordflow">return</span> <a class="code" href="bt_scalar_8h.html#21b4d7889e86774c7f56b4a9da21e4f9">btSwapEndian</a>((<span class="keywordtype">unsigned</span>)val);
<a name="l00432"></a>00432 }
<a name="l00433"></a>00433
<a name="l00434"></a><a class="code" href="bt_scalar_8h.html#37fef177a45696453f84b5de8b5a2dd3">00434</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> <a class="code" href="bt_scalar_8h.html#21b4d7889e86774c7f56b4a9da21e4f9">btSwapEndian</a>(<span class="keywordtype">short</span> val)
<a name="l00435"></a>00435 {
<a name="l00436"></a>00436 <span class="keywordflow">return</span> <a class="code" href="bt_scalar_8h.html#21b4d7889e86774c7f56b4a9da21e4f9">btSwapEndian</a>((<span class="keywordtype">unsigned</span> <span class="keywordtype">short</span>)val);
<a name="l00437"></a>00437 }
<a name="l00438"></a>00438
<a name="l00445"></a><a class="code" href="bt_scalar_8h.html#f37c54c90dcb716e0190b9c41eb0f3dc">00445</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> uint32_t <a class="code" href="bt_scalar_8h.html#f37c54c90dcb716e0190b9c41eb0f3dc" title="btSwapFloat uses using char pointers to swap the endianness">btSwapEndianFloat</a>(<span class="keywordtype">float</span> d)
<a name="l00446"></a>00446 {
<a name="l00447"></a>00447 uint32_t a = 0;
<a name="l00448"></a>00448 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>* dst = (<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>*)&a;
<a name="l00449"></a>00449 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>* src = (<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>*)&d;
<a name="l00450"></a>00450
<a name="l00451"></a>00451 dst[0] = src[3];
<a name="l00452"></a>00452 dst[1] = src[2];
<a name="l00453"></a>00453 dst[2] = src[1];
<a name="l00454"></a>00454 dst[3] = src[0];
<a name="l00455"></a>00455 <span class="keywordflow">return</span> a;
<a name="l00456"></a>00456 }
<a name="l00457"></a>00457
<a name="l00458"></a>00458 <span class="comment">// unswap using char pointers</span>
<a name="l00459"></a><a class="code" href="bt_scalar_8h.html#cde4b445d01bf42cb389be3cc9ddeccd">00459</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <span class="keywordtype">float</span> <a class="code" href="bt_scalar_8h.html#cde4b445d01bf42cb389be3cc9ddeccd">btUnswapEndianFloat</a>(uint32_t a)
<a name="l00460"></a>00460 {
<a name="l00461"></a>00461 <span class="keywordtype">float</span> d = 0.0f;
<a name="l00462"></a>00462 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>* src = (<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>*)&a;
<a name="l00463"></a>00463 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>* dst = (<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>*)&d;
<a name="l00464"></a>00464
<a name="l00465"></a>00465 dst[0] = src[3];
<a name="l00466"></a>00466 dst[1] = src[2];
<a name="l00467"></a>00467 dst[2] = src[1];
<a name="l00468"></a>00468 dst[3] = src[0];
<a name="l00469"></a>00469
<a name="l00470"></a>00470 <span class="keywordflow">return</span> d;
<a name="l00471"></a>00471 }
<a name="l00472"></a>00472
<a name="l00473"></a>00473 <span class="comment">// swap using char pointers</span>
<a name="l00474"></a><a class="code" href="bt_scalar_8h.html#29e3fd9bbf730416c5d60c18ae21b1ba">00474</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <span class="keywordtype">void</span> <a class="code" href="bt_scalar_8h.html#29e3fd9bbf730416c5d60c18ae21b1ba">btSwapEndianDouble</a>(<span class="keywordtype">double</span> d, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>* dst)
<a name="l00475"></a>00475 {
<a name="l00476"></a>00476 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>* src = (<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>*)&d;
<a name="l00477"></a>00477
<a name="l00478"></a>00478 dst[0] = src[7];
<a name="l00479"></a>00479 dst[1] = src[6];
<a name="l00480"></a>00480 dst[2] = src[5];
<a name="l00481"></a>00481 dst[3] = src[4];
<a name="l00482"></a>00482 dst[4] = src[3];
<a name="l00483"></a>00483 dst[5] = src[2];
<a name="l00484"></a>00484 dst[6] = src[1];
<a name="l00485"></a>00485 dst[7] = src[0];
<a name="l00486"></a>00486 }
<a name="l00487"></a>00487
<a name="l00488"></a>00488 <span class="comment">// unswap using char pointers</span>
<a name="l00489"></a><a class="code" href="bt_scalar_8h.html#0092a5e4ef2131b31a2d3f669e2d4abf">00489</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <span class="keywordtype">double</span> <a class="code" href="bt_scalar_8h.html#0092a5e4ef2131b31a2d3f669e2d4abf">btUnswapEndianDouble</a>(<span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>* src)
<a name="l00490"></a>00490 {
<a name="l00491"></a>00491 <span class="keywordtype">double</span> d = 0.0;
<a name="l00492"></a>00492 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>* dst = (<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>*)&d;
<a name="l00493"></a>00493
<a name="l00494"></a>00494 dst[0] = src[7];
<a name="l00495"></a>00495 dst[1] = src[6];
<a name="l00496"></a>00496 dst[2] = src[5];
<a name="l00497"></a>00497 dst[3] = src[4];
<a name="l00498"></a>00498 dst[4] = src[3];
<a name="l00499"></a>00499 dst[5] = src[2];
<a name="l00500"></a>00500 dst[6] = src[1];
<a name="l00501"></a>00501 dst[7] = src[0];
<a name="l00502"></a>00502
<a name="l00503"></a>00503 <span class="keywordflow">return</span> d;
<a name="l00504"></a>00504 }
<a name="l00505"></a>00505
<a name="l00506"></a>00506 <span class="comment">// returns normalized value in range [-SIMD_PI, SIMD_PI]</span>
<a name="l00507"></a><a class="code" href="bt_scalar_8h.html#451c9dba9cd626281ab92dec7705b1a3">00507</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> <a class="code" href="bt_scalar_8h.html#451c9dba9cd626281ab92dec7705b1a3">btNormalizeAngle</a>(<a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> angleInRadians)
<a name="l00508"></a>00508 {
<a name="l00509"></a>00509 angleInRadians = <a class="code" href="bt_scalar_8h.html#e7ebb0f0f37c7851cf64cdae2075ca2f">btFmod</a>(angleInRadians, <a class="code" href="bt_scalar_8h.html#fa3dad5a5edb29663834714c0ef492bb">SIMD_2_PI</a>);
<a name="l00510"></a>00510 <span class="keywordflow">if</span> (angleInRadians < -<a class="code" href="bt_scalar_8h.html#1bdff187c878167505bcedbbbabf7b0a">SIMD_PI</a>) {
<a name="l00511"></a>00511 <span class="keywordflow">return</span> angleInRadians + <a class="code" href="bt_scalar_8h.html#fa3dad5a5edb29663834714c0ef492bb">SIMD_2_PI</a>;
<a name="l00512"></a>00512 }
<a name="l00513"></a>00513 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (angleInRadians > <a class="code" href="bt_scalar_8h.html#1bdff187c878167505bcedbbbabf7b0a">SIMD_PI</a>) {
<a name="l00514"></a>00514 <span class="keywordflow">return</span> angleInRadians - <a class="code" href="bt_scalar_8h.html#fa3dad5a5edb29663834714c0ef492bb">SIMD_2_PI</a>;
<a name="l00515"></a>00515 }
<a name="l00516"></a>00516 <span class="keywordflow">else</span> {
<a name="l00517"></a>00517 <span class="keywordflow">return</span> angleInRadians;
<a name="l00518"></a>00518 }
<a name="l00519"></a>00519 }
<a name="l00520"></a>00520
<a name="l00522"></a><a class="code" href="structbt_typed_object.html">00522</a> <span class="keyword">struct </span><a class="code" href="structbt_typed_object.html" title="rudimentary class to provide type info">btTypedObject</a> {
<a name="l00523"></a><a class="code" href="structbt_typed_object.html#f10da9ddb749e24940da236199d920cd">00523</a> <a class="code" href="structbt_typed_object.html#f10da9ddb749e24940da236199d920cd">btTypedObject</a>(int32_t objectType)
<a name="l00524"></a>00524 : <a class="code" href="structbt_typed_object.html#c600a3119429dab41dc6b4ca64762ee2">m_objectType</a>(objectType)
<a name="l00525"></a>00525 {
<a name="l00526"></a>00526 }
<a name="l00527"></a><a class="code" href="structbt_typed_object.html#c600a3119429dab41dc6b4ca64762ee2">00527</a> int32_t <a class="code" href="structbt_typed_object.html#c600a3119429dab41dc6b4ca64762ee2">m_objectType</a>;
<a name="l00528"></a><a class="code" href="structbt_typed_object.html#89ec4b523dcc4749bf902dea09a7419c">00528</a> <span class="keyword">inline</span> int32_t <a class="code" href="structbt_typed_object.html#89ec4b523dcc4749bf902dea09a7419c">getObjectType</a>()<span class="keyword"> const</span>
<a name="l00529"></a>00529 <span class="keyword"> </span>{
<a name="l00530"></a>00530 <span class="keywordflow">return</span> <a class="code" href="structbt_typed_object.html#c600a3119429dab41dc6b4ca64762ee2">m_objectType</a>;
<a name="l00531"></a>00531 }
<a name="l00532"></a>00532 };
<a name="l00533"></a>00533 <span class="preprocessor">#endif //BT_SCALAR_H</span>
</pre></div></div>
<!-- start footer part -->
<div class="footer">
Copyright © 2015-2017 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. <a href="http://www.nvidia.com ">www.nvidia.com</a>
</div>
</body>
</html>
|