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
|
<html>
<head>
<title>NVIDIA(R) Blast(R) SDK 1.1 Source Reference: sdk/extensions/authoring/source/VHACD/inc/btConvexHullComputer.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/btConvexHullComputer.h</h1><a href="bt_convex_hull_computer_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) 2011 Ole Kniemeyer, MAXON, www.maxon.net</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_CONVEX_HULL_COMPUTER_H</span>
<a name="l00016"></a>00016 <span class="preprocessor"></span><span class="preprocessor">#define BT_CONVEX_HULL_COMPUTER_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_aligned_object_array_8h.html">btAlignedObjectArray.h</a>"</span>
<a name="l00019"></a>00019 <span class="preprocessor">#include "<a class="code" href="bt_vector3_8h.html">btVector3.h</a>"</span>
<a name="l00020"></a>00020
<a name="l00024"></a><a class="code" href="classbt_convex_hull_computer.html">00024</a> <span class="keyword">class </span><a class="code" href="classbt_convex_hull_computer.html">btConvexHullComputer</a> {
<a name="l00025"></a>00025 <span class="keyword">private</span>:
<a name="l00026"></a>00026 <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> compute(<span class="keyword">const</span> <span class="keywordtype">void</span>* coords, <span class="keywordtype">bool</span> doubleCoords, int32_t stride, int32_t count, <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> shrink, <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> shrinkClamp);
<a name="l00027"></a>00027
<a name="l00028"></a>00028 <span class="keyword">public</span>:
<a name="l00029"></a><a class="code" href="classbt_convex_hull_computer_1_1_edge.html">00029</a> <span class="keyword">class </span><a class="code" href="classbt_convex_hull_computer_1_1_edge.html">Edge</a> {
<a name="l00030"></a>00030 <span class="keyword">private</span>:
<a name="l00031"></a>00031 int32_t next;
<a name="l00032"></a>00032 int32_t reverse;
<a name="l00033"></a>00033 int32_t targetVertex;
<a name="l00034"></a>00034
<a name="l00035"></a><a class="code" href="classbt_convex_hull_computer_1_1_edge.html#cce0ec14217db877328c5854838aca49">00035</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classbt_convex_hull_computer.html">btConvexHullComputer</a>;
<a name="l00036"></a>00036
<a name="l00037"></a>00037 <span class="keyword">public</span>:
<a name="l00038"></a><a class="code" href="classbt_convex_hull_computer_1_1_edge.html#5659cbb75473c4cc6afbf08231b5dc28">00038</a> int32_t <a class="code" href="classbt_convex_hull_computer_1_1_edge.html#5659cbb75473c4cc6afbf08231b5dc28">getSourceVertex</a>()<span class="keyword"> const</span>
<a name="l00039"></a>00039 <span class="keyword"> </span>{
<a name="l00040"></a>00040 <span class="keywordflow">return</span> (<span class="keyword">this</span> + reverse)->targetVertex;
<a name="l00041"></a>00041 }
<a name="l00042"></a>00042
<a name="l00043"></a><a class="code" href="classbt_convex_hull_computer_1_1_edge.html#4cd3e59258c02d39d158d2a4181962f6">00043</a> int32_t <a class="code" href="classbt_convex_hull_computer_1_1_edge.html#4cd3e59258c02d39d158d2a4181962f6">getTargetVertex</a>()<span class="keyword"> const</span>
<a name="l00044"></a>00044 <span class="keyword"> </span>{
<a name="l00045"></a>00045 <span class="keywordflow">return</span> targetVertex;
<a name="l00046"></a>00046 }
<a name="l00047"></a>00047
<a name="l00048"></a><a class="code" href="classbt_convex_hull_computer_1_1_edge.html#7ec61a383494c5afe35d9a6a209ace15">00048</a> <span class="keyword">const</span> <a class="code" href="classbt_convex_hull_computer_1_1_edge.html">Edge</a>* <a class="code" href="classbt_convex_hull_computer_1_1_edge.html#7ec61a383494c5afe35d9a6a209ace15">getNextEdgeOfVertex</a>() const <span class="comment">// clockwise list of all edges of a vertex</span>
<a name="l00049"></a>00049 {
<a name="l00050"></a>00050 <span class="keywordflow">return</span> <span class="keyword">this</span> + next;
<a name="l00051"></a>00051 }
<a name="l00052"></a>00052
<a name="l00053"></a><a class="code" href="classbt_convex_hull_computer_1_1_edge.html#c0f3f1b5a69f8a8c5fdff7a56d2e3867">00053</a> <span class="keyword">const</span> <a class="code" href="classbt_convex_hull_computer_1_1_edge.html">Edge</a>* <a class="code" href="classbt_convex_hull_computer_1_1_edge.html#c0f3f1b5a69f8a8c5fdff7a56d2e3867">getNextEdgeOfFace</a>() const <span class="comment">// counter-clockwise list of all edges of a face</span>
<a name="l00054"></a>00054 {
<a name="l00055"></a>00055 <span class="keywordflow">return</span> (<span class="keyword">this</span> + reverse)-><a class="code" href="classbt_convex_hull_computer_1_1_edge.html#7ec61a383494c5afe35d9a6a209ace15">getNextEdgeOfVertex</a>();
<a name="l00056"></a>00056 }
<a name="l00057"></a>00057
<a name="l00058"></a><a class="code" href="classbt_convex_hull_computer_1_1_edge.html#1025860922e163acb3bc1a48c83fa7ba">00058</a> <span class="keyword">const</span> <a class="code" href="classbt_convex_hull_computer_1_1_edge.html">Edge</a>* <a class="code" href="classbt_convex_hull_computer_1_1_edge.html#1025860922e163acb3bc1a48c83fa7ba">getReverseEdge</a>()<span class="keyword"> const</span>
<a name="l00059"></a>00059 <span class="keyword"> </span>{
<a name="l00060"></a>00060 <span class="keywordflow">return</span> <span class="keyword">this</span> + reverse;
<a name="l00061"></a>00061 }
<a name="l00062"></a>00062 };
<a name="l00063"></a>00063
<a name="l00064"></a>00064 <span class="comment">// Vertices of the output hull</span>
<a name="l00065"></a><a class="code" href="classbt_convex_hull_computer.html#44b13cded1cd7726d3f18c2f6f98c7cc">00065</a> <a class="code" href="classbt_aligned_object_array.html">btAlignedObjectArray<btVector3></a> <a class="code" href="classbt_convex_hull_computer.html#44b13cded1cd7726d3f18c2f6f98c7cc">vertices</a>;
<a name="l00066"></a>00066
<a name="l00067"></a>00067 <span class="comment">// Edges of the output hull</span>
<a name="l00068"></a><a class="code" href="classbt_convex_hull_computer.html#fd8c62200e928bf2db95ee77ed9dc887">00068</a> <a class="code" href="classbt_aligned_object_array.html">btAlignedObjectArray<Edge></a> <a class="code" href="classbt_convex_hull_computer.html#fd8c62200e928bf2db95ee77ed9dc887">edges</a>;
<a name="l00069"></a>00069
<a name="l00070"></a>00070 <span class="comment">// Faces of the convex hull. Each entry is an index into the "edges" array pointing to an edge of the face. Faces are planar n-gons</span>
<a name="l00071"></a><a class="code" href="classbt_convex_hull_computer.html#428dc0b27831ad91f018f999490bc019">00071</a> <a class="code" href="classbt_aligned_object_array.html">btAlignedObjectArray<int32_t></a> <a class="code" href="classbt_convex_hull_computer.html#428dc0b27831ad91f018f999490bc019">faces</a>;
<a name="l00072"></a>00072
<a name="l00073"></a>00073 <span class="comment">/*</span>
<a name="l00074"></a>00074 <span class="comment"> Compute convex hull of "count" vertices stored in "coords". "stride" is the difference in bytes</span>
<a name="l00075"></a>00075 <span class="comment"> between the addresses of consecutive vertices. If "shrink" is positive, the convex hull is shrunken</span>
<a name="l00076"></a>00076 <span class="comment"> by that amount (each face is moved by "shrink" length units towards the center along its normal).</span>
<a name="l00077"></a>00077 <span class="comment"> If "shrinkClamp" is positive, "shrink" is clamped to not exceed "shrinkClamp * innerRadius", where "innerRadius"</span>
<a name="l00078"></a>00078 <span class="comment"> is the minimum distance of a face to the center of the convex hull.</span>
<a name="l00079"></a>00079 <span class="comment"></span>
<a name="l00080"></a>00080 <span class="comment"> The returned value is the amount by which the hull has been shrunken. If it is negative, the amount was so large</span>
<a name="l00081"></a>00081 <span class="comment"> that the resulting convex hull is empty.</span>
<a name="l00082"></a>00082 <span class="comment"></span>
<a name="l00083"></a>00083 <span class="comment"> The output convex hull can be found in the member variables "vertices", "edges", "faces".</span>
<a name="l00084"></a>00084 <span class="comment"> */</span>
<a name="l00085"></a><a class="code" href="classbt_convex_hull_computer.html#1a41f091552e8c13655dc6709dfd10be">00085</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> compute(<span class="keyword">const</span> <span class="keywordtype">float</span>* coords, int32_t stride, int32_t count, <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> shrink, <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> shrinkClamp)
<a name="l00086"></a>00086 {
<a name="l00087"></a>00087 <span class="keywordflow">return</span> compute(coords, <span class="keyword">false</span>, stride, count, shrink, shrinkClamp);
<a name="l00088"></a>00088 }
<a name="l00089"></a>00089
<a name="l00090"></a>00090 <span class="comment">// same as above, but double precision</span>
<a name="l00091"></a><a class="code" href="classbt_convex_hull_computer.html#eacd833d00ce40ce90afdd95149d7b15">00091</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> compute(<span class="keyword">const</span> <span class="keywordtype">double</span>* coords, int32_t stride, int32_t count, <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> shrink, <a class="code" href="bt_scalar_8h.html#1e5824cfc8adbf5a77f2622132d16018" title="The btScalar type abstracts floating point numbers, to easily switch between double...">btScalar</a> shrinkClamp)
<a name="l00092"></a>00092 {
<a name="l00093"></a>00093 <span class="keywordflow">return</span> compute(coords, <span class="keyword">true</span>, stride, count, shrink, shrinkClamp);
<a name="l00094"></a>00094 }
<a name="l00095"></a>00095 };
<a name="l00096"></a>00096
<a name="l00097"></a>00097 <span class="preprocessor">#endif //BT_CONVEX_HULL_COMPUTER_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>
|