aboutsummaryrefslogtreecommitdiff
path: root/docs/source_docs/files/bt_min_max_8h-source.html
blob: 136cd1bad65f410061a5bf08139cd81075582ee7 (plain) (blame)
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
<html>
	<head>
		<title>NVIDIA(R) Blast(R) SDK 1.1 Source Reference: sdk/extensions/authoring/source/VHACD/inc/btMinMax.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> &nbsp; 
				<!-- <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; //-->
				<a class="qindex" href="annotated.html">Class List</a> &nbsp; 
				<a class="qindex" href="functions.html">Class Members</a> &nbsp;  
			</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&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>User's&nbsp;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&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
<h1>sdk/extensions/authoring/source/VHACD/inc/btMinMax.h</h1><a href="bt_min_max_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-2006 Gino van den Bergen / Erwin Coumans  http://continuousphysics.com/Bullet/</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_GEN_MINMAX_H</span>
<a name="l00016"></a>00016 <span class="preprocessor"></span><span class="preprocessor">#define BT_GEN_MINMAX_H</span>
<a name="l00017"></a>00017 <span class="preprocessor"></span>
<a name="l00018"></a>00018 <span class="preprocessor">#include "<a class="code" href="bt_scalar_8h.html">btScalar.h</a>"</span>
<a name="l00019"></a>00019 
<a name="l00020"></a>00020 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l00021"></a><a class="code" href="bt_min_max_8h.html#083aab7ffec01586f450c9f2696f7fe5">00021</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <span class="keyword">const</span> T&amp; <a class="code" href="bt_min_max_8h.html#083aab7ffec01586f450c9f2696f7fe5">btMin</a>(<span class="keyword">const</span> T&amp; a, <span class="keyword">const</span> T&amp; b)
<a name="l00022"></a>00022 {
<a name="l00023"></a>00023     <span class="keywordflow">return</span> a &lt; b ? a : b;
<a name="l00024"></a>00024 }
<a name="l00025"></a>00025 
<a name="l00026"></a>00026 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l00027"></a><a class="code" href="bt_min_max_8h.html#c663fae9d94f02fb5a2d45828aa91ba1">00027</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <span class="keyword">const</span> T&amp; <a class="code" href="bt_min_max_8h.html#c663fae9d94f02fb5a2d45828aa91ba1">btMax</a>(<span class="keyword">const</span> T&amp; a, <span class="keyword">const</span> T&amp; b)
<a name="l00028"></a>00028 {
<a name="l00029"></a>00029     <span class="keywordflow">return</span> a &gt; b ? a : b;
<a name="l00030"></a>00030 }
<a name="l00031"></a>00031 
<a name="l00032"></a>00032 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l00033"></a><a class="code" href="bt_min_max_8h.html#83a7544c7b531242ea8cd1eff90ed654">00033</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <span class="keyword">const</span> T&amp; <a class="code" href="bt_min_max_8h.html#83a7544c7b531242ea8cd1eff90ed654">btClamped</a>(<span class="keyword">const</span> T&amp; a, <span class="keyword">const</span> T&amp; lb, <span class="keyword">const</span> T&amp; ub)
<a name="l00034"></a>00034 {
<a name="l00035"></a>00035     <span class="keywordflow">return</span> a &lt; lb ? lb : (ub &lt; a ? ub : a);
<a name="l00036"></a>00036 }
<a name="l00037"></a>00037 
<a name="l00038"></a>00038 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l00039"></a><a class="code" href="bt_min_max_8h.html#c374523bb40e4ff491f6fd197fcb3c04">00039</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <span class="keywordtype">void</span> <a class="code" href="bt_min_max_8h.html#c374523bb40e4ff491f6fd197fcb3c04">btSetMin</a>(T&amp; a, <span class="keyword">const</span> T&amp; b)
<a name="l00040"></a>00040 {
<a name="l00041"></a>00041     <span class="keywordflow">if</span> (b &lt; a) {
<a name="l00042"></a>00042         a = b;
<a name="l00043"></a>00043     }
<a name="l00044"></a>00044 }
<a name="l00045"></a>00045 
<a name="l00046"></a>00046 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l00047"></a><a class="code" href="bt_min_max_8h.html#b894df8ce3487473677c66e682702046">00047</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <span class="keywordtype">void</span> <a class="code" href="bt_min_max_8h.html#b894df8ce3487473677c66e682702046">btSetMax</a>(T&amp; a, <span class="keyword">const</span> T&amp; b)
<a name="l00048"></a>00048 {
<a name="l00049"></a>00049     <span class="keywordflow">if</span> (a &lt; b) {
<a name="l00050"></a>00050         a = b;
<a name="l00051"></a>00051     }
<a name="l00052"></a>00052 }
<a name="l00053"></a>00053 
<a name="l00054"></a>00054 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l00055"></a><a class="code" href="bt_min_max_8h.html#fc2b4412407f38914610311f01c50445">00055</a> <a class="code" href="bt_scalar_8h.html#8a6a3e8b28846a3d7271e376c738ec40">SIMD_FORCE_INLINE</a> <span class="keywordtype">void</span> <a class="code" href="bt_min_max_8h.html#fc2b4412407f38914610311f01c50445">btClamp</a>(T&amp; a, <span class="keyword">const</span> T&amp; lb, <span class="keyword">const</span> T&amp; ub)
<a name="l00056"></a>00056 {
<a name="l00057"></a>00057     <span class="keywordflow">if</span> (a &lt; lb) {
<a name="l00058"></a>00058         a = lb;
<a name="l00059"></a>00059     }
<a name="l00060"></a>00060     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (ub &lt; a) {
<a name="l00061"></a>00061         a = ub;
<a name="l00062"></a>00062     }
<a name="l00063"></a>00063 }
<a name="l00064"></a>00064 
<a name="l00065"></a>00065 <span class="preprocessor">#endif //BT_GEN_MINMAX_H</span>
</pre></div></div>
<!-- start footer part -->
<div class="footer">
Copyright &copy; 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>