aboutsummaryrefslogtreecommitdiff
path: root/PhysX_3.4/Documentation/PhysXAPI/files/PxMassProperties_8h-source.html
blob: 7356e86b9b8f2b70196aa3cd8ceb3136025bacb9 (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
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
<html>
	<head>
		<title>NVIDIA(R) PhysX(R) SDK 3.4 API Reference: PxMassProperties.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="images/PhysXlogo.png" align="middle"> <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">Compound List</a> &nbsp; 
				<a class="qindex" href="functions.html">Compound Members</a> &nbsp;  
			</center>
			<hr class="second">
		</div>
<!-- Generated by Doxygen 1.5.8 -->
<h1>PxMassProperties.h</h1><a href="PxMassProperties_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">// Redistribution and use in source and binary forms, with or without</span>
<a name="l00003"></a>00003 <span class="comment">// modification, are permitted provided that the following conditions</span>
<a name="l00004"></a>00004 <span class="comment">// are met:</span>
<a name="l00005"></a>00005 <span class="comment">//  * Redistributions of source code must retain the above copyright</span>
<a name="l00006"></a>00006 <span class="comment">//    notice, this list of conditions and the following disclaimer.</span>
<a name="l00007"></a>00007 <span class="comment">//  * Redistributions in binary form must reproduce the above copyright</span>
<a name="l00008"></a>00008 <span class="comment">//    notice, this list of conditions and the following disclaimer in the</span>
<a name="l00009"></a>00009 <span class="comment">//    documentation and/or other materials provided with the distribution.</span>
<a name="l00010"></a>00010 <span class="comment">//  * Neither the name of NVIDIA CORPORATION nor the names of its</span>
<a name="l00011"></a>00011 <span class="comment">//    contributors may be used to endorse or promote products derived</span>
<a name="l00012"></a>00012 <span class="comment">//    from this software without specific prior written permission.</span>
<a name="l00013"></a>00013 <span class="comment">//</span>
<a name="l00014"></a>00014 <span class="comment">// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY</span>
<a name="l00015"></a>00015 <span class="comment">// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE</span>
<a name="l00016"></a>00016 <span class="comment">// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR</span>
<a name="l00017"></a>00017 <span class="comment">// PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR</span>
<a name="l00018"></a>00018 <span class="comment">// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,</span>
<a name="l00019"></a>00019 <span class="comment">// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,</span>
<a name="l00020"></a>00020 <span class="comment">// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR</span>
<a name="l00021"></a>00021 <span class="comment">// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY</span>
<a name="l00022"></a>00022 <span class="comment">// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT</span>
<a name="l00023"></a>00023 <span class="comment">// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE</span>
<a name="l00024"></a>00024 <span class="comment">// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span>
<a name="l00025"></a>00025 <span class="comment">//</span>
<a name="l00026"></a>00026 <span class="comment">// Copyright (c) 2008-2018 NVIDIA Corporation. All rights reserved.</span>
<a name="l00027"></a>00027 <span class="comment">// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.</span>
<a name="l00028"></a>00028 <span class="comment">// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.  </span>
<a name="l00029"></a>00029 
<a name="l00030"></a>00030 
<a name="l00031"></a>00031 <span class="preprocessor">#ifndef PX_PHYSICS_EXTENSIONS_MASS_PROPERTIES_H</span>
<a name="l00032"></a>00032 <span class="preprocessor"></span><span class="preprocessor">#define PX_PHYSICS_EXTENSIONS_MASS_PROPERTIES_H</span>
<a name="l00033"></a>00033 <span class="preprocessor"></span>
<a name="l00037"></a>00037 <span class="preprocessor">#include "<a class="code" href="PxPhysXConfig_8h.html">PxPhysXConfig.h</a>"</span>
<a name="l00038"></a>00038 <span class="preprocessor">#include "<a class="code" href="PxMath_8h.html">foundation/PxMath.h</a>"</span>
<a name="l00039"></a>00039 <span class="preprocessor">#include "<a class="code" href="PxMathUtils_8h.html">foundation/PxMathUtils.h</a>"</span>
<a name="l00040"></a>00040 <span class="preprocessor">#include "<a class="code" href="PxVec3_8h.html">foundation/PxVec3.h</a>"</span>
<a name="l00041"></a>00041 <span class="preprocessor">#include "<a class="code" href="PxMat33_8h.html">foundation/PxMat33.h</a>"</span>
<a name="l00042"></a>00042 <span class="preprocessor">#include "<a class="code" href="PxQuat_8h.html">foundation/PxQuat.h</a>"</span>
<a name="l00043"></a>00043 <span class="preprocessor">#include "<a class="code" href="PxTransform_8h.html">foundation/PxTransform.h</a>"</span>
<a name="l00044"></a>00044 <span class="preprocessor">#include "<a class="code" href="PxGeometry_8h.html">geometry/PxGeometry.h</a>"</span>
<a name="l00045"></a>00045 <span class="preprocessor">#include "<a class="code" href="PxBoxGeometry_8h.html">geometry/PxBoxGeometry.h</a>"</span>
<a name="l00046"></a>00046 <span class="preprocessor">#include "<a class="code" href="PxSphereGeometry_8h.html">geometry/PxSphereGeometry.h</a>"</span>
<a name="l00047"></a>00047 <span class="preprocessor">#include "<a class="code" href="PxCapsuleGeometry_8h.html">geometry/PxCapsuleGeometry.h</a>"</span>
<a name="l00048"></a>00048 <span class="preprocessor">#include "<a class="code" href="PxConvexMeshGeometry_8h.html">geometry/PxConvexMeshGeometry.h</a>"</span>
<a name="l00049"></a>00049 <span class="preprocessor">#include "<a class="code" href="PxConvexMesh_8h.html">geometry/PxConvexMesh.h</a>"</span>
<a name="l00050"></a>00050 
<a name="l00051"></a>00051 <span class="preprocessor">#if !PX_DOXYGEN</span>
<a name="l00052"></a>00052 <span class="preprocessor"></span><span class="keyword">namespace </span>physx
<a name="l00053"></a>00053 {
<a name="l00054"></a>00054 <span class="preprocessor">#endif</span>
<a name="l00055"></a>00055 <span class="preprocessor"></span>
<a name="l00063"></a><a class="code" href="classPxMassProperties.html">00063</a> <span class="keyword">class </span><a class="code" href="classPxMassProperties.html" title="Utility class to compute and manipulate mass and inertia tensor properties.">PxMassProperties</a>
<a name="l00064"></a>00064 {
<a name="l00065"></a>00065 <span class="keyword">public</span>:
<a name="l00069"></a><a class="code" href="classPxMassProperties.html#1cbdb127fcb5b2b3617693e24ccdb49b">00069</a>     <a class="code" href="group__foundation.html#g6a774eed3cad34b0f636332a3d28c6bb">PX_FORCE_INLINE</a> <a class="code" href="classPxMassProperties.html#1cbdb127fcb5b2b3617693e24ccdb49b" title="Default constructor.">PxMassProperties</a>() : inertiaTensor(<a class="code" href="group__foundation.html#gg70160ca5bbafef277790b3e0f12baf3895e14c69af8048aedd218cd6e96ad50f">PxIdentity</a>), centerOfMass(0.0f), mass(1.0f) {}
<a name="l00070"></a>00070 
<a name="l00074"></a><a class="code" href="classPxMassProperties.html#5a7eadca391b0cd981c0b35e08c82662">00074</a>     <a class="code" href="group__foundation.html#g6a774eed3cad34b0f636332a3d28c6bb">PX_FORCE_INLINE</a> <a class="code" href="classPxMassProperties.html#5a7eadca391b0cd981c0b35e08c82662" title="Construct from individual elements.">PxMassProperties</a>(<span class="keyword">const</span> <a class="code" href="namespacephysx.html#727d2d8426e2a21ebbc522fa65c3f97a">PxReal</a> m, <span class="keyword">const</span> <a class="code" href="classPxMat33.html" title="3x3 matrix class">PxMat33</a>&amp; inertiaT, <span class="keyword">const</span> <a class="code" href="classPxVec3.html" title="3 Element vector class.">PxVec3</a>&amp; com) : inertiaTensor(inertiaT), centerOfMass(com), mass(m) {}
<a name="l00075"></a>00075 
<a name="l00083"></a><a class="code" href="classPxMassProperties.html#cc8eadc90e93df0e25d4dfb63988a596">00083</a>     <a class="code" href="classPxMassProperties.html" title="Utility class to compute and manipulate mass and inertia tensor properties.">PxMassProperties</a>(<span class="keyword">const</span> <a class="code" href="classPxGeometry.html" title="A geometry object.">PxGeometry</a>&amp; geometry)
<a name="l00084"></a>00084     {
<a name="l00085"></a>00085         <span class="keywordflow">switch</span> (geometry.<a class="code" href="classPxGeometry.html#da00045053aaa9bdc56eeb38066cbe29" title="Returns the type of the geometry.">getType</a>())
<a name="l00086"></a>00086         {
<a name="l00087"></a>00087             <span class="keywordflow">case</span> <a class="code" href="structPxGeometryType.html#efc79f72c4c479192ac19d41a6f30ed52c5cbcb67ffa54ebcdc1674f12b07fb8">PxGeometryType::eSPHERE</a>:
<a name="l00088"></a>00088             {
<a name="l00089"></a>00089                 <span class="keyword">const</span> <a class="code" href="classPxSphereGeometry.html" title="A class representing the geometry of a sphere.">PxSphereGeometry</a>&amp; s = <span class="keyword">static_cast&lt;</span><span class="keyword">const </span><a class="code" href="classPxSphereGeometry.html" title="A class representing the geometry of a sphere.">PxSphereGeometry</a>&amp;<span class="keyword">&gt;</span>(geometry);
<a name="l00090"></a>00090                 mass = (4.0f / 3.0f) * <a class="code" href="group__foundation.html#gbcd49a429b8119de54375b3538ae8a8d">PxPi</a> * s.<a class="code" href="classPxSphereGeometry.html#092be2e608f402b2c2da0309ad6fb2df" title="The radius of the sphere.">radius</a> * s.<a class="code" href="classPxSphereGeometry.html#092be2e608f402b2c2da0309ad6fb2df" title="The radius of the sphere.">radius</a> * s.<a class="code" href="classPxSphereGeometry.html#092be2e608f402b2c2da0309ad6fb2df" title="The radius of the sphere.">radius</a>;
<a name="l00091"></a>00091                 inertiaTensor = <a class="code" href="classPxMat33.html#e7052afa072d3c45c1f570a6a794c6a5" title="Construct from diagonal, off-diagonals are zero.">PxMat33::createDiagonal</a>(<a class="code" href="classPxVec3.html" title="3 Element vector class.">PxVec3</a>(2.0f / 5.0f * mass * s.<a class="code" href="classPxSphereGeometry.html#092be2e608f402b2c2da0309ad6fb2df" title="The radius of the sphere.">radius</a> * s.<a class="code" href="classPxSphereGeometry.html#092be2e608f402b2c2da0309ad6fb2df" title="The radius of the sphere.">radius</a>));
<a name="l00092"></a>00092                 centerOfMass = <a class="code" href="classPxVec3.html" title="3 Element vector class.">PxVec3</a>(0.0f);
<a name="l00093"></a>00093             }
<a name="l00094"></a>00094             <span class="keywordflow">break</span>;
<a name="l00095"></a>00095 
<a name="l00096"></a>00096             <span class="keywordflow">case</span> <a class="code" href="structPxGeometryType.html#efc79f72c4c479192ac19d41a6f30ed54ac248bdee2283c0471c9dc0eba40c34">PxGeometryType::eBOX</a>:
<a name="l00097"></a>00097             {
<a name="l00098"></a>00098                 <span class="keyword">const</span> <a class="code" href="classPxBoxGeometry.html" title="Class representing the geometry of a box.">PxBoxGeometry</a>&amp; b = <span class="keyword">static_cast&lt;</span><span class="keyword">const </span><a class="code" href="classPxBoxGeometry.html" title="Class representing the geometry of a box.">PxBoxGeometry</a>&amp;<span class="keyword">&gt;</span>(geometry);
<a name="l00099"></a>00099                 mass = b.<a class="code" href="classPxBoxGeometry.html#8fe8be4ca1467353956634d550dc8561" title="Half of the width, height, and depth of the box.">halfExtents</a>.<a class="code" href="classPxVec3.html#391194bca8291161c06254f4ac2b6ada">x</a> * b.<a class="code" href="classPxBoxGeometry.html#8fe8be4ca1467353956634d550dc8561" title="Half of the width, height, and depth of the box.">halfExtents</a>.<a class="code" href="classPxVec3.html#29958700f50da2204edc519b47706a05">y</a> * b.<a class="code" href="classPxBoxGeometry.html#8fe8be4ca1467353956634d550dc8561" title="Half of the width, height, and depth of the box.">halfExtents</a>.<a class="code" href="classPxVec3.html#50d67b162b99b904c3f362ad0415dbca">z</a> * 8.0f;
<a name="l00100"></a>00100                 <a class="code" href="classPxVec3.html" title="3 Element vector class.">PxVec3</a> d2 = b.<a class="code" href="classPxBoxGeometry.html#8fe8be4ca1467353956634d550dc8561" title="Half of the width, height, and depth of the box.">halfExtents</a>.<a class="code" href="classPxVec3.html#9cc40866bdd9940ef8a3cc8d2a75a593" title="a[i] * b[i], for all i.">multiply</a>(b.<a class="code" href="classPxBoxGeometry.html#8fe8be4ca1467353956634d550dc8561" title="Half of the width, height, and depth of the box.">halfExtents</a>);
<a name="l00101"></a>00101                 inertiaTensor = <a class="code" href="classPxMat33.html#e7052afa072d3c45c1f570a6a794c6a5" title="Construct from diagonal, off-diagonals are zero.">PxMat33::createDiagonal</a>(<a class="code" href="classPxVec3.html" title="3 Element vector class.">PxVec3</a>(d2.<a class="code" href="classPxVec3.html#29958700f50da2204edc519b47706a05">y</a> + d2.<a class="code" href="classPxVec3.html#50d67b162b99b904c3f362ad0415dbca">z</a>, d2.<a class="code" href="classPxVec3.html#391194bca8291161c06254f4ac2b6ada">x</a> + d2.<a class="code" href="classPxVec3.html#50d67b162b99b904c3f362ad0415dbca">z</a>, d2.<a class="code" href="classPxVec3.html#391194bca8291161c06254f4ac2b6ada">x</a> + d2.<a class="code" href="classPxVec3.html#29958700f50da2204edc519b47706a05">y</a>)) * (mass * 1.0f / 3.0f);
<a name="l00102"></a>00102                 centerOfMass = <a class="code" href="classPxVec3.html" title="3 Element vector class.">PxVec3</a>(0.0f);
<a name="l00103"></a>00103             }
<a name="l00104"></a>00104             <span class="keywordflow">break</span>;
<a name="l00105"></a>00105 
<a name="l00106"></a>00106             <span class="keywordflow">case</span> <a class="code" href="structPxGeometryType.html#efc79f72c4c479192ac19d41a6f30ed578c4217b41a6ba726f8a77faecf46bb8">PxGeometryType::eCAPSULE</a>:
<a name="l00107"></a>00107             {
<a name="l00108"></a>00108                 <span class="keyword">const</span> <a class="code" href="classPxCapsuleGeometry.html" title="Class representing the geometry of a capsule.">PxCapsuleGeometry</a>&amp; c = <span class="keyword">static_cast&lt;</span><span class="keyword">const </span><a class="code" href="classPxCapsuleGeometry.html" title="Class representing the geometry of a capsule.">PxCapsuleGeometry</a>&amp;<span class="keyword">&gt;</span>(geometry);
<a name="l00109"></a>00109                 <a class="code" href="namespacephysx.html#727d2d8426e2a21ebbc522fa65c3f97a">PxReal</a> r = c.<a class="code" href="classPxCapsuleGeometry.html#c4f07af35bc86338c5bd01e11266dadd" title="The radius of the capsule.">radius</a>, h = c.<a class="code" href="classPxCapsuleGeometry.html#f5affd7d085f89d0a90a35b97214cc40" title="half of the capsule&amp;#39;s height, measured between the centers of the hemispherical...">halfHeight</a>;
<a name="l00110"></a>00110                 mass = ((4.0f / 3.0f) * r + 2 * c.<a class="code" href="classPxCapsuleGeometry.html#f5affd7d085f89d0a90a35b97214cc40" title="half of the capsule&amp;#39;s height, measured between the centers of the hemispherical...">halfHeight</a>) * <a class="code" href="group__foundation.html#gbcd49a429b8119de54375b3538ae8a8d">PxPi</a> * r * r;
<a name="l00111"></a>00111 
<a name="l00112"></a>00112                 <a class="code" href="namespacephysx.html#727d2d8426e2a21ebbc522fa65c3f97a">PxReal</a> a = r*r*r * (8.0f / 15.0f) + h*r*r * (3.0f / 2.0f) + h*h*r * (4.0f / 3.0f) + h*h*h * (2.0f / 3.0f);
<a name="l00113"></a>00113                 <a class="code" href="namespacephysx.html#727d2d8426e2a21ebbc522fa65c3f97a">PxReal</a> b = r*r*r * (8.0f / 15.0f) + h*r*r;
<a name="l00114"></a>00114                 inertiaTensor = <a class="code" href="classPxMat33.html#e7052afa072d3c45c1f570a6a794c6a5" title="Construct from diagonal, off-diagonals are zero.">PxMat33::createDiagonal</a>(<a class="code" href="classPxVec3.html" title="3 Element vector class.">PxVec3</a>(b, a, a) * <a class="code" href="group__foundation.html#gbcd49a429b8119de54375b3538ae8a8d">PxPi</a> * r * r);
<a name="l00115"></a>00115                 centerOfMass = <a class="code" href="classPxVec3.html" title="3 Element vector class.">PxVec3</a>(0.0f);
<a name="l00116"></a>00116             }
<a name="l00117"></a>00117             <span class="keywordflow">break</span>;
<a name="l00118"></a>00118 
<a name="l00119"></a>00119             <span class="keywordflow">case</span> <a class="code" href="structPxGeometryType.html#efc79f72c4c479192ac19d41a6f30ed59f3d57b4f0e71ce2a6cf29bee36162ed">PxGeometryType::eCONVEXMESH</a>:
<a name="l00120"></a>00120             {
<a name="l00121"></a>00121                 <span class="keyword">const</span> <a class="code" href="classPxConvexMeshGeometry.html" title="Convex mesh geometry class.">PxConvexMeshGeometry</a>&amp; c = <span class="keyword">static_cast&lt;</span><span class="keyword">const </span><a class="code" href="classPxConvexMeshGeometry.html" title="Convex mesh geometry class.">PxConvexMeshGeometry</a>&amp;<span class="keyword">&gt;</span>(geometry);
<a name="l00122"></a>00122                 <a class="code" href="classPxVec3.html" title="3 Element vector class.">PxVec3</a> unscaledCoM;
<a name="l00123"></a>00123                 <a class="code" href="classPxMat33.html" title="3x3 matrix class">PxMat33</a> unscaledInertiaTensorNonCOM; <span class="comment">// inertia tensor of convex mesh in mesh local space</span>
<a name="l00124"></a>00124                 <a class="code" href="classPxMat33.html" title="3x3 matrix class">PxMat33</a> unscaledInertiaTensorCOM;
<a name="l00125"></a>00125                 <a class="code" href="namespacephysx.html#727d2d8426e2a21ebbc522fa65c3f97a">PxReal</a> unscaledMass;
<a name="l00126"></a>00126                 c.<a class="code" href="classPxConvexMeshGeometry.html#2fdc589d347de81e55c8b45b7c133feb" title="A reference to the convex mesh object.">convexMesh</a>-&gt;<a class="code" href="classPxConvexMesh.html#497cea6e1975b9081760afc602985bbc" title="Returns the mass properties of the mesh assuming unit density.">getMassInformation</a>(unscaledMass, unscaledInertiaTensorNonCOM, unscaledCoM);               
<a name="l00127"></a>00127 
<a name="l00128"></a>00128                 <span class="comment">// inertia tensor relative to center of mass</span>
<a name="l00129"></a>00129                 unscaledInertiaTensorCOM[0][0] = unscaledInertiaTensorNonCOM[0][0] - unscaledMass*<a class="code" href="namespacephysx.html#727d2d8426e2a21ebbc522fa65c3f97a">PxReal</a>((unscaledCoM.<a class="code" href="classPxVec3.html#29958700f50da2204edc519b47706a05">y</a>*unscaledCoM.<a class="code" href="classPxVec3.html#29958700f50da2204edc519b47706a05">y</a>+unscaledCoM.<a class="code" href="classPxVec3.html#50d67b162b99b904c3f362ad0415dbca">z</a>*unscaledCoM.<a class="code" href="classPxVec3.html#50d67b162b99b904c3f362ad0415dbca">z</a>));
<a name="l00130"></a>00130                 unscaledInertiaTensorCOM[1][1] = unscaledInertiaTensorNonCOM[1][1] - unscaledMass*<a class="code" href="namespacephysx.html#727d2d8426e2a21ebbc522fa65c3f97a">PxReal</a>((unscaledCoM.<a class="code" href="classPxVec3.html#50d67b162b99b904c3f362ad0415dbca">z</a>*unscaledCoM.<a class="code" href="classPxVec3.html#50d67b162b99b904c3f362ad0415dbca">z</a>+unscaledCoM.<a class="code" href="classPxVec3.html#391194bca8291161c06254f4ac2b6ada">x</a>*unscaledCoM.<a class="code" href="classPxVec3.html#391194bca8291161c06254f4ac2b6ada">x</a>));
<a name="l00131"></a>00131                 unscaledInertiaTensorCOM[2][2] = unscaledInertiaTensorNonCOM[2][2] - unscaledMass*<a class="code" href="namespacephysx.html#727d2d8426e2a21ebbc522fa65c3f97a">PxReal</a>((unscaledCoM.<a class="code" href="classPxVec3.html#391194bca8291161c06254f4ac2b6ada">x</a>*unscaledCoM.<a class="code" href="classPxVec3.html#391194bca8291161c06254f4ac2b6ada">x</a>+unscaledCoM.<a class="code" href="classPxVec3.html#29958700f50da2204edc519b47706a05">y</a>*unscaledCoM.<a class="code" href="classPxVec3.html#29958700f50da2204edc519b47706a05">y</a>));
<a name="l00132"></a>00132                 unscaledInertiaTensorCOM[0][1] = unscaledInertiaTensorCOM[1][0] = (unscaledInertiaTensorNonCOM[0][1] + unscaledMass*<a class="code" href="namespacephysx.html#727d2d8426e2a21ebbc522fa65c3f97a">PxReal</a>(unscaledCoM.<a class="code" href="classPxVec3.html#391194bca8291161c06254f4ac2b6ada">x</a>*unscaledCoM.<a class="code" href="classPxVec3.html#29958700f50da2204edc519b47706a05">y</a>));
<a name="l00133"></a>00133                 unscaledInertiaTensorCOM[1][2] = unscaledInertiaTensorCOM[2][1] = (unscaledInertiaTensorNonCOM[1][2] + unscaledMass*<a class="code" href="namespacephysx.html#727d2d8426e2a21ebbc522fa65c3f97a">PxReal</a>(unscaledCoM.<a class="code" href="classPxVec3.html#29958700f50da2204edc519b47706a05">y</a>*unscaledCoM.<a class="code" href="classPxVec3.html#50d67b162b99b904c3f362ad0415dbca">z</a>));
<a name="l00134"></a>00134                 unscaledInertiaTensorCOM[0][2] = unscaledInertiaTensorCOM[2][0] = (unscaledInertiaTensorNonCOM[0][2] + unscaledMass*<a class="code" href="namespacephysx.html#727d2d8426e2a21ebbc522fa65c3f97a">PxReal</a>(unscaledCoM.<a class="code" href="classPxVec3.html#50d67b162b99b904c3f362ad0415dbca">z</a>*unscaledCoM.<a class="code" href="classPxVec3.html#391194bca8291161c06254f4ac2b6ada">x</a>));
<a name="l00135"></a>00135 
<a name="l00136"></a>00136                 <span class="keyword">const</span> <a class="code" href="classPxMeshScale.html" title="A class expressing a nonuniform scaling transformation.">PxMeshScale</a>&amp; s = c.<a class="code" href="classPxConvexMeshGeometry.html#777f625bb1fd49fabf03eb4be02ed581" title="The scaling transformation (from vertex space to shape space).">scale</a>;
<a name="l00137"></a>00137                 mass = unscaledMass * s.<a class="code" href="classPxMeshScale.html#12f2dbcf5214c4c5956dab0e75831449" title="A nonuniform scaling.">scale</a>.<a class="code" href="classPxVec3.html#391194bca8291161c06254f4ac2b6ada">x</a> * s.<a class="code" href="classPxMeshScale.html#12f2dbcf5214c4c5956dab0e75831449" title="A nonuniform scaling.">scale</a>.<a class="code" href="classPxVec3.html#29958700f50da2204edc519b47706a05">y</a> * s.<a class="code" href="classPxMeshScale.html#12f2dbcf5214c4c5956dab0e75831449" title="A nonuniform scaling.">scale</a>.<a class="code" href="classPxVec3.html#50d67b162b99b904c3f362ad0415dbca">z</a>;
<a name="l00138"></a>00138                 centerOfMass = s.<a class="code" href="classPxMeshScale.html#63902c04c9a3f326b5f969fa931e53fd" title="The orientation of the scaling axes.">rotation</a>.<a class="code" href="classPxQuat.html#b5ffbf8b2b7bd871e6ac0b854fd5730e">rotate</a>(s.<a class="code" href="classPxMeshScale.html#12f2dbcf5214c4c5956dab0e75831449" title="A nonuniform scaling.">scale</a>.<a class="code" href="classPxVec3.html#9cc40866bdd9940ef8a3cc8d2a75a593" title="a[i] * b[i], for all i.">multiply</a>(s.<a class="code" href="classPxMeshScale.html#63902c04c9a3f326b5f969fa931e53fd" title="The orientation of the scaling axes.">rotation</a>.<a class="code" href="classPxQuat.html#6ce4a234b750b076459632e60579cf78">rotateInv</a>(unscaledCoM)));
<a name="l00139"></a>00139                 inertiaTensor = scaleInertia(unscaledInertiaTensorCOM, s.<a class="code" href="classPxMeshScale.html#63902c04c9a3f326b5f969fa931e53fd" title="The orientation of the scaling axes.">rotation</a>, s.<a class="code" href="classPxMeshScale.html#12f2dbcf5214c4c5956dab0e75831449" title="A nonuniform scaling.">scale</a>);
<a name="l00140"></a>00140             }
<a name="l00141"></a>00141             <span class="keywordflow">break</span>;
<a name="l00142"></a>00142 
<a name="l00143"></a>00143             <span class="keywordflow">case</span> <a class="code" href="structPxGeometryType.html#efc79f72c4c479192ac19d41a6f30ed577b1d68c4f5a18bc259a623e1497a880">PxGeometryType::eHEIGHTFIELD</a>:
<a name="l00144"></a>00144             <span class="keywordflow">case</span> <a class="code" href="structPxGeometryType.html#efc79f72c4c479192ac19d41a6f30ed531e6fe000bdf2ba4c3bd2527351247fc">PxGeometryType::ePLANE</a>:
<a name="l00145"></a>00145             <span class="keywordflow">case</span> <a class="code" href="structPxGeometryType.html#efc79f72c4c479192ac19d41a6f30ed56b3210a7dca3bddcc8755338987725eb">PxGeometryType::eTRIANGLEMESH</a>:
<a name="l00146"></a>00146             <span class="keywordflow">case</span> <a class="code" href="structPxGeometryType.html#efc79f72c4c479192ac19d41a6f30ed573f7721d7db869464f4038638466d5ac" title="internal use only!">PxGeometryType::eINVALID</a>:
<a name="l00147"></a>00147             <span class="keywordflow">case</span> <a class="code" href="structPxGeometryType.html#efc79f72c4c479192ac19d41a6f30ed5fa28e3dbd2e28f7c0948c35723f42105" title="internal use only!">PxGeometryType::eGEOMETRY_COUNT</a>:
<a name="l00148"></a>00148             {
<a name="l00149"></a>00149                 *<span class="keyword">this</span> = <a class="code" href="classPxMassProperties.html" title="Utility class to compute and manipulate mass and inertia tensor properties.">PxMassProperties</a>();
<a name="l00150"></a>00150             }
<a name="l00151"></a>00151             <span class="keywordflow">break</span>;
<a name="l00152"></a>00152         }
<a name="l00153"></a>00153 
<a name="l00154"></a>00154         <a class="code" href="group__foundation.html#g4a83a657390b324a460f14684e5accee">PX_ASSERT</a>(inertiaTensor.column0.isFinite() &amp;&amp; inertiaTensor.column1.isFinite() &amp;&amp; inertiaTensor.column2.isFinite());
<a name="l00155"></a>00155         <a class="code" href="group__foundation.html#g4a83a657390b324a460f14684e5accee">PX_ASSERT</a>(centerOfMass.isFinite());
<a name="l00156"></a>00156         <a class="code" href="group__foundation.html#g4a83a657390b324a460f14684e5accee">PX_ASSERT</a>(<a class="code" href="group__foundation.html#gd6de0f4af98c5c5280b8fe695dc87318" title="returns true if the passed number is a finite floating point number as opposed to...">PxIsFinite</a>(mass));
<a name="l00157"></a>00157     }
<a name="l00158"></a>00158 
<a name="l00165"></a><a class="code" href="classPxMassProperties.html#17203e50d0713712a2784a2ad51ed198">00165</a>     <a class="code" href="group__foundation.html#g6a774eed3cad34b0f636332a3d28c6bb">PX_FORCE_INLINE</a> <a class="code" href="classPxMassProperties.html" title="Utility class to compute and manipulate mass and inertia tensor properties.">PxMassProperties</a> <a class="code" href="group__foundation.html#ga7415102b45174d3eda4d4f2f12127bc">operator*</a>(<span class="keyword">const</span> <a class="code" href="namespacephysx.html#727d2d8426e2a21ebbc522fa65c3f97a">PxReal</a> scale)<span class="keyword"> const</span>
<a name="l00166"></a>00166 <span class="keyword">    </span>{
<a name="l00167"></a>00167         <a class="code" href="group__foundation.html#g4a83a657390b324a460f14684e5accee">PX_ASSERT</a>(<a class="code" href="group__foundation.html#gd6de0f4af98c5c5280b8fe695dc87318" title="returns true if the passed number is a finite floating point number as opposed to...">PxIsFinite</a>(scale));
<a name="l00168"></a>00168 
<a name="l00169"></a>00169         <span class="keywordflow">return</span> <a class="code" href="classPxMassProperties.html" title="Utility class to compute and manipulate mass and inertia tensor properties.">PxMassProperties</a>(mass * scale, inertiaTensor * scale, centerOfMass);
<a name="l00170"></a>00170     }
<a name="l00171"></a>00171 
<a name="l00177"></a><a class="code" href="classPxMassProperties.html#6b65afdb22147ade5f1ca7f77e591924">00177</a>     <a class="code" href="group__foundation.html#g6a774eed3cad34b0f636332a3d28c6bb">PX_FORCE_INLINE</a> <span class="keywordtype">void</span> translate(<span class="keyword">const</span> <a class="code" href="classPxVec3.html" title="3 Element vector class.">PxVec3</a>&amp; t)
<a name="l00178"></a>00178     {
<a name="l00179"></a>00179         <a class="code" href="group__foundation.html#g4a83a657390b324a460f14684e5accee">PX_ASSERT</a>(t.<a class="code" href="classPxVec3.html#65b6f42ac7654a7d79590a2f1d00e160" title="returns true if all 3 elems of the vector are finite (not NAN or INF, etc.)">isFinite</a>());
<a name="l00180"></a>00180 
<a name="l00181"></a>00181         inertiaTensor = translateInertia(inertiaTensor, mass, t);
<a name="l00182"></a>00182         centerOfMass += t;
<a name="l00183"></a>00183 
<a name="l00184"></a>00184         <a class="code" href="group__foundation.html#g4a83a657390b324a460f14684e5accee">PX_ASSERT</a>(inertiaTensor.column0.isFinite() &amp;&amp; inertiaTensor.column1.isFinite() &amp;&amp; inertiaTensor.column2.isFinite());
<a name="l00185"></a>00185         <a class="code" href="group__foundation.html#g4a83a657390b324a460f14684e5accee">PX_ASSERT</a>(centerOfMass.isFinite());
<a name="l00186"></a>00186     }
<a name="l00187"></a>00187 
<a name="l00195"></a><a class="code" href="classPxMassProperties.html#53afd0d4b906ee9d96b23ea0bb41287b">00195</a>     <a class="code" href="group__foundation.html#g6a774eed3cad34b0f636332a3d28c6bb">PX_FORCE_INLINE</a> <span class="keyword">static</span> <a class="code" href="classPxVec3.html" title="3 Element vector class.">PxVec3</a> getMassSpaceInertia(<span class="keyword">const</span> <a class="code" href="classPxMat33.html" title="3x3 matrix class">PxMat33</a>&amp; inertia, <a class="code" href="classPxQuat.html" title="This is a quaternion class. For more information on quaternion mathematics consult...">PxQuat</a>&amp; massFrame)
<a name="l00196"></a>00196     {
<a name="l00197"></a>00197         <a class="code" href="group__foundation.html#g4a83a657390b324a460f14684e5accee">PX_ASSERT</a>(inertia.<a class="code" href="classPxMat33.html#89d12d4e50ffc5ef8e480bdd3dadb78a">column0</a>.<a class="code" href="classPxVec3.html#65b6f42ac7654a7d79590a2f1d00e160" title="returns true if all 3 elems of the vector are finite (not NAN or INF, etc.)">isFinite</a>() &amp;&amp; inertia.<a class="code" href="classPxMat33.html#62f190479e12e7b9ec5cf831b23c95e9">column1</a>.<a class="code" href="classPxVec3.html#65b6f42ac7654a7d79590a2f1d00e160" title="returns true if all 3 elems of the vector are finite (not NAN or INF, etc.)">isFinite</a>() &amp;&amp; inertia.<a class="code" href="classPxMat33.html#9af2a3d4f9cca979c3e46a6406de6957">column2</a>.<a class="code" href="classPxVec3.html#65b6f42ac7654a7d79590a2f1d00e160" title="returns true if all 3 elems of the vector are finite (not NAN or INF, etc.)">isFinite</a>());
<a name="l00198"></a>00198 
<a name="l00199"></a>00199         <a class="code" href="classPxVec3.html" title="3 Element vector class.">PxVec3</a> diagT = <a class="code" href="group__common.html#gde7a77d4ae9d14e363364a9d72cf4932">PxDiagonalize</a>(inertia, massFrame);
<a name="l00200"></a>00200         <a class="code" href="group__foundation.html#g4a83a657390b324a460f14684e5accee">PX_ASSERT</a>(diagT.isFinite());
<a name="l00201"></a>00201         <a class="code" href="group__foundation.html#g4a83a657390b324a460f14684e5accee">PX_ASSERT</a>(massFrame.<a class="code" href="classPxQuat.html#a435b2284fdc3d4ad85bec6074f2bad4" title="returns true if all elements are finite (not NAN or INF, etc.)">isFinite</a>());
<a name="l00202"></a>00202         <span class="keywordflow">return</span> diagT;
<a name="l00203"></a>00203     }
<a name="l00204"></a>00204 
<a name="l00213"></a><a class="code" href="classPxMassProperties.html#cf94746d2a0e2e989bad06d97c6c387b">00213</a>     <a class="code" href="group__foundation.html#g6a774eed3cad34b0f636332a3d28c6bb">PX_FORCE_INLINE</a> <span class="keyword">static</span> <a class="code" href="classPxMat33.html" title="3x3 matrix class">PxMat33</a> translateInertia(<span class="keyword">const</span> <a class="code" href="classPxMat33.html" title="3x3 matrix class">PxMat33</a>&amp; inertia, <span class="keyword">const</span> <a class="code" href="namespacephysx.html#727d2d8426e2a21ebbc522fa65c3f97a">PxReal</a> mass, <span class="keyword">const</span> <a class="code" href="classPxVec3.html" title="3 Element vector class.">PxVec3</a>&amp; t)
<a name="l00214"></a>00214     {
<a name="l00215"></a>00215         <a class="code" href="group__foundation.html#g4a83a657390b324a460f14684e5accee">PX_ASSERT</a>(inertia.<a class="code" href="classPxMat33.html#89d12d4e50ffc5ef8e480bdd3dadb78a">column0</a>.<a class="code" href="classPxVec3.html#65b6f42ac7654a7d79590a2f1d00e160" title="returns true if all 3 elems of the vector are finite (not NAN or INF, etc.)">isFinite</a>() &amp;&amp; inertia.<a class="code" href="classPxMat33.html#62f190479e12e7b9ec5cf831b23c95e9">column1</a>.<a class="code" href="classPxVec3.html#65b6f42ac7654a7d79590a2f1d00e160" title="returns true if all 3 elems of the vector are finite (not NAN or INF, etc.)">isFinite</a>() &amp;&amp; inertia.<a class="code" href="classPxMat33.html#9af2a3d4f9cca979c3e46a6406de6957">column2</a>.<a class="code" href="classPxVec3.html#65b6f42ac7654a7d79590a2f1d00e160" title="returns true if all 3 elems of the vector are finite (not NAN or INF, etc.)">isFinite</a>());
<a name="l00216"></a>00216         <a class="code" href="group__foundation.html#g4a83a657390b324a460f14684e5accee">PX_ASSERT</a>(<a class="code" href="group__foundation.html#gd6de0f4af98c5c5280b8fe695dc87318" title="returns true if the passed number is a finite floating point number as opposed to...">PxIsFinite</a>(mass));
<a name="l00217"></a>00217         <a class="code" href="group__foundation.html#g4a83a657390b324a460f14684e5accee">PX_ASSERT</a>(t.<a class="code" href="classPxVec3.html#65b6f42ac7654a7d79590a2f1d00e160" title="returns true if all 3 elems of the vector are finite (not NAN or INF, etc.)">isFinite</a>());
<a name="l00218"></a>00218 
<a name="l00219"></a>00219         <a class="code" href="classPxMat33.html" title="3x3 matrix class">PxMat33</a> s(  <a class="code" href="classPxVec3.html" title="3 Element vector class.">PxVec3</a>(0,t.<a class="code" href="classPxVec3.html#50d67b162b99b904c3f362ad0415dbca">z</a>,-t.<a class="code" href="classPxVec3.html#29958700f50da2204edc519b47706a05">y</a>),
<a name="l00220"></a>00220                     <a class="code" href="classPxVec3.html" title="3 Element vector class.">PxVec3</a>(-t.<a class="code" href="classPxVec3.html#50d67b162b99b904c3f362ad0415dbca">z</a>,0,t.<a class="code" href="classPxVec3.html#391194bca8291161c06254f4ac2b6ada">x</a>),
<a name="l00221"></a>00221                     <a class="code" href="classPxVec3.html" title="3 Element vector class.">PxVec3</a>(t.<a class="code" href="classPxVec3.html#29958700f50da2204edc519b47706a05">y</a>,-t.<a class="code" href="classPxVec3.html#391194bca8291161c06254f4ac2b6ada">x</a>,0) );
<a name="l00222"></a>00222 
<a name="l00223"></a>00223         <a class="code" href="classPxMat33.html" title="3x3 matrix class">PxMat33</a> translatedIT = s.getTranspose() * s * mass + inertia;
<a name="l00224"></a>00224         <a class="code" href="group__foundation.html#g4a83a657390b324a460f14684e5accee">PX_ASSERT</a>(translatedIT.<a class="code" href="classPxMat33.html#89d12d4e50ffc5ef8e480bdd3dadb78a">column0</a>.<a class="code" href="classPxVec3.html#65b6f42ac7654a7d79590a2f1d00e160" title="returns true if all 3 elems of the vector are finite (not NAN or INF, etc.)">isFinite</a>() &amp;&amp; translatedIT.<a class="code" href="classPxMat33.html#62f190479e12e7b9ec5cf831b23c95e9">column1</a>.<a class="code" href="classPxVec3.html#65b6f42ac7654a7d79590a2f1d00e160" title="returns true if all 3 elems of the vector are finite (not NAN or INF, etc.)">isFinite</a>() &amp;&amp; translatedIT.<a class="code" href="classPxMat33.html#9af2a3d4f9cca979c3e46a6406de6957">column2</a>.<a class="code" href="classPxVec3.html#65b6f42ac7654a7d79590a2f1d00e160" title="returns true if all 3 elems of the vector are finite (not NAN or INF, etc.)">isFinite</a>());
<a name="l00225"></a>00225         <span class="keywordflow">return</span> translatedIT;
<a name="l00226"></a>00226     }
<a name="l00227"></a>00227 
<a name="l00235"></a><a class="code" href="classPxMassProperties.html#4d63a246cd8a59f8709126a4b4528fb6">00235</a>     <a class="code" href="group__foundation.html#g6a774eed3cad34b0f636332a3d28c6bb">PX_FORCE_INLINE</a> <span class="keyword">static</span> <a class="code" href="classPxMat33.html" title="3x3 matrix class">PxMat33</a> rotateInertia(<span class="keyword">const</span> <a class="code" href="classPxMat33.html" title="3x3 matrix class">PxMat33</a>&amp; inertia, <span class="keyword">const</span> <a class="code" href="classPxQuat.html" title="This is a quaternion class. For more information on quaternion mathematics consult...">PxQuat</a>&amp; q)
<a name="l00236"></a>00236     {
<a name="l00237"></a>00237         <a class="code" href="group__foundation.html#g4a83a657390b324a460f14684e5accee">PX_ASSERT</a>(inertia.<a class="code" href="classPxMat33.html#89d12d4e50ffc5ef8e480bdd3dadb78a">column0</a>.<a class="code" href="classPxVec3.html#65b6f42ac7654a7d79590a2f1d00e160" title="returns true if all 3 elems of the vector are finite (not NAN or INF, etc.)">isFinite</a>() &amp;&amp; inertia.<a class="code" href="classPxMat33.html#62f190479e12e7b9ec5cf831b23c95e9">column1</a>.<a class="code" href="classPxVec3.html#65b6f42ac7654a7d79590a2f1d00e160" title="returns true if all 3 elems of the vector are finite (not NAN or INF, etc.)">isFinite</a>() &amp;&amp; inertia.<a class="code" href="classPxMat33.html#9af2a3d4f9cca979c3e46a6406de6957">column2</a>.<a class="code" href="classPxVec3.html#65b6f42ac7654a7d79590a2f1d00e160" title="returns true if all 3 elems of the vector are finite (not NAN or INF, etc.)">isFinite</a>());
<a name="l00238"></a>00238         <a class="code" href="group__foundation.html#g4a83a657390b324a460f14684e5accee">PX_ASSERT</a>(q.<a class="code" href="classPxQuat.html#3890ca4efba038ab0fc84bb39c5267db" title="returns true if finite and magnitude is close to unit">isUnit</a>());
<a name="l00239"></a>00239 
<a name="l00240"></a>00240         <a class="code" href="classPxMat33.html" title="3x3 matrix class">PxMat33</a> m(q);
<a name="l00241"></a>00241         <a class="code" href="classPxMat33.html" title="3x3 matrix class">PxMat33</a> rotatedIT = m * inertia * m.<a class="code" href="classPxMat33.html#4ac2e5e46952e91a18126a5de02d2697" title="Get transposed matrix.">getTranspose</a>();
<a name="l00242"></a>00242         <a class="code" href="group__foundation.html#g4a83a657390b324a460f14684e5accee">PX_ASSERT</a>(rotatedIT.<a class="code" href="classPxMat33.html#89d12d4e50ffc5ef8e480bdd3dadb78a">column0</a>.<a class="code" href="classPxVec3.html#65b6f42ac7654a7d79590a2f1d00e160" title="returns true if all 3 elems of the vector are finite (not NAN or INF, etc.)">isFinite</a>() &amp;&amp; rotatedIT.<a class="code" href="classPxMat33.html#62f190479e12e7b9ec5cf831b23c95e9">column1</a>.<a class="code" href="classPxVec3.html#65b6f42ac7654a7d79590a2f1d00e160" title="returns true if all 3 elems of the vector are finite (not NAN or INF, etc.)">isFinite</a>() &amp;&amp; rotatedIT.<a class="code" href="classPxMat33.html#9af2a3d4f9cca979c3e46a6406de6957">column2</a>.<a class="code" href="classPxVec3.html#65b6f42ac7654a7d79590a2f1d00e160" title="returns true if all 3 elems of the vector are finite (not NAN or INF, etc.)">isFinite</a>());
<a name="l00243"></a>00243         <span class="keywordflow">return</span> rotatedIT;
<a name="l00244"></a>00244     }
<a name="l00245"></a>00245 
<a name="l00254"></a><a class="code" href="classPxMassProperties.html#4ba3bf338320c9f0bf558b5d3a9046bd">00254</a>     <span class="keyword">static</span> <a class="code" href="classPxMat33.html" title="3x3 matrix class">PxMat33</a> scaleInertia(<span class="keyword">const</span> <a class="code" href="classPxMat33.html" title="3x3 matrix class">PxMat33</a>&amp; inertia, <span class="keyword">const</span> <a class="code" href="classPxQuat.html" title="This is a quaternion class. For more information on quaternion mathematics consult...">PxQuat</a>&amp; scaleRotation, <span class="keyword">const</span> <a class="code" href="classPxVec3.html" title="3 Element vector class.">PxVec3</a>&amp; scale)
<a name="l00255"></a>00255     {
<a name="l00256"></a>00256         <a class="code" href="group__foundation.html#g4a83a657390b324a460f14684e5accee">PX_ASSERT</a>(inertia.<a class="code" href="classPxMat33.html#89d12d4e50ffc5ef8e480bdd3dadb78a">column0</a>.<a class="code" href="classPxVec3.html#65b6f42ac7654a7d79590a2f1d00e160" title="returns true if all 3 elems of the vector are finite (not NAN or INF, etc.)">isFinite</a>() &amp;&amp; inertia.<a class="code" href="classPxMat33.html#62f190479e12e7b9ec5cf831b23c95e9">column1</a>.<a class="code" href="classPxVec3.html#65b6f42ac7654a7d79590a2f1d00e160" title="returns true if all 3 elems of the vector are finite (not NAN or INF, etc.)">isFinite</a>() &amp;&amp; inertia.<a class="code" href="classPxMat33.html#9af2a3d4f9cca979c3e46a6406de6957">column2</a>.<a class="code" href="classPxVec3.html#65b6f42ac7654a7d79590a2f1d00e160" title="returns true if all 3 elems of the vector are finite (not NAN or INF, etc.)">isFinite</a>());
<a name="l00257"></a>00257         <a class="code" href="group__foundation.html#g4a83a657390b324a460f14684e5accee">PX_ASSERT</a>(scaleRotation.<a class="code" href="classPxQuat.html#3890ca4efba038ab0fc84bb39c5267db" title="returns true if finite and magnitude is close to unit">isUnit</a>());
<a name="l00258"></a>00258         <a class="code" href="group__foundation.html#g4a83a657390b324a460f14684e5accee">PX_ASSERT</a>(scale.<a class="code" href="classPxVec3.html#65b6f42ac7654a7d79590a2f1d00e160" title="returns true if all 3 elems of the vector are finite (not NAN or INF, etc.)">isFinite</a>());
<a name="l00259"></a>00259 
<a name="l00260"></a>00260         <a class="code" href="classPxMat33.html" title="3x3 matrix class">PxMat33</a> localInertiaT = rotateInertia(inertia, scaleRotation); <span class="comment">// rotate inertia into scaling frame</span>
<a name="l00261"></a>00261         <a class="code" href="classPxVec3.html" title="3 Element vector class.">PxVec3</a> diagonal(localInertiaT[0][0], localInertiaT[1][1], localInertiaT[2][2]);
<a name="l00262"></a>00262 
<a name="l00263"></a>00263         <a class="code" href="classPxVec3.html" title="3 Element vector class.">PxVec3</a> xyz2 = <a class="code" href="classPxVec3.html" title="3 Element vector class.">PxVec3</a>(diagonal.<a class="code" href="classPxVec3.html#f29c27e8aae481d97570e7990388bdf5" title="returns the scalar product of this and other.">dot</a>(<a class="code" href="classPxVec3.html" title="3 Element vector class.">PxVec3</a>(0.5f))) - diagonal; <span class="comment">// original x^2, y^2, z^2</span>
<a name="l00264"></a>00264         <a class="code" href="classPxVec3.html" title="3 Element vector class.">PxVec3</a> scaledxyz2 = xyz2.<a class="code" href="classPxVec3.html#9cc40866bdd9940ef8a3cc8d2a75a593" title="a[i] * b[i], for all i.">multiply</a>(scale).<a class="code" href="classPxVec3.html#9cc40866bdd9940ef8a3cc8d2a75a593" title="a[i] * b[i], for all i.">multiply</a>(scale);
<a name="l00265"></a>00265 
<a name="l00266"></a>00266         <a class="code" href="namespacephysx.html#727d2d8426e2a21ebbc522fa65c3f97a">PxReal</a>  xx = scaledxyz2.y + scaledxyz2.z,
<a name="l00267"></a>00267                 yy = scaledxyz2.z + scaledxyz2.x,
<a name="l00268"></a>00268                 zz = scaledxyz2.x + scaledxyz2.y;
<a name="l00269"></a>00269 
<a name="l00270"></a>00270         <a class="code" href="namespacephysx.html#727d2d8426e2a21ebbc522fa65c3f97a">PxReal</a>  xy = localInertiaT[0][1] * scale.<a class="code" href="classPxVec3.html#391194bca8291161c06254f4ac2b6ada">x</a> * scale.<a class="code" href="classPxVec3.html#29958700f50da2204edc519b47706a05">y</a>,
<a name="l00271"></a>00271                 xz = localInertiaT[0][2] * scale.<a class="code" href="classPxVec3.html#391194bca8291161c06254f4ac2b6ada">x</a> * scale.<a class="code" href="classPxVec3.html#50d67b162b99b904c3f362ad0415dbca">z</a>,
<a name="l00272"></a>00272                 yz = localInertiaT[1][2] * scale.<a class="code" href="classPxVec3.html#29958700f50da2204edc519b47706a05">y</a> * scale.<a class="code" href="classPxVec3.html#50d67b162b99b904c3f362ad0415dbca">z</a>;
<a name="l00273"></a>00273 
<a name="l00274"></a>00274         <a class="code" href="classPxMat33.html" title="3x3 matrix class">PxMat33</a> scaledInertia(  <a class="code" href="classPxVec3.html" title="3 Element vector class.">PxVec3</a>(xx, xy, xz),
<a name="l00275"></a>00275                                 <a class="code" href="classPxVec3.html" title="3 Element vector class.">PxVec3</a>(xy, yy, yz),
<a name="l00276"></a>00276                                 <a class="code" href="classPxVec3.html" title="3 Element vector class.">PxVec3</a>(xz, yz, zz));
<a name="l00277"></a>00277 
<a name="l00278"></a>00278         <a class="code" href="classPxMat33.html" title="3x3 matrix class">PxMat33</a> scaledIT = rotateInertia(scaledInertia * (scale.<a class="code" href="classPxVec3.html#391194bca8291161c06254f4ac2b6ada">x</a> * scale.<a class="code" href="classPxVec3.html#29958700f50da2204edc519b47706a05">y</a> * scale.<a class="code" href="classPxVec3.html#50d67b162b99b904c3f362ad0415dbca">z</a>), scaleRotation.<a class="code" href="classPxQuat.html#a4418a046f8851753a23a375515b0614">getConjugate</a>());
<a name="l00279"></a>00279         <a class="code" href="group__foundation.html#g4a83a657390b324a460f14684e5accee">PX_ASSERT</a>(scaledIT.<a class="code" href="classPxMat33.html#89d12d4e50ffc5ef8e480bdd3dadb78a">column0</a>.<a class="code" href="classPxVec3.html#65b6f42ac7654a7d79590a2f1d00e160" title="returns true if all 3 elems of the vector are finite (not NAN or INF, etc.)">isFinite</a>() &amp;&amp; scaledIT.<a class="code" href="classPxMat33.html#62f190479e12e7b9ec5cf831b23c95e9">column1</a>.<a class="code" href="classPxVec3.html#65b6f42ac7654a7d79590a2f1d00e160" title="returns true if all 3 elems of the vector are finite (not NAN or INF, etc.)">isFinite</a>() &amp;&amp; scaledIT.<a class="code" href="classPxMat33.html#9af2a3d4f9cca979c3e46a6406de6957">column2</a>.<a class="code" href="classPxVec3.html#65b6f42ac7654a7d79590a2f1d00e160" title="returns true if all 3 elems of the vector are finite (not NAN or INF, etc.)">isFinite</a>());
<a name="l00280"></a>00280         <span class="keywordflow">return</span> scaledIT;
<a name="l00281"></a>00281     }
<a name="l00282"></a>00282 
<a name="l00291"></a><a class="code" href="classPxMassProperties.html#63e7875cb60efa35150002e56fcfa43f">00291</a>     <span class="keyword">static</span> <a class="code" href="classPxMassProperties.html" title="Utility class to compute and manipulate mass and inertia tensor properties.">PxMassProperties</a> sum(<span class="keyword">const</span> <a class="code" href="classPxMassProperties.html" title="Utility class to compute and manipulate mass and inertia tensor properties.">PxMassProperties</a>* props, <span class="keyword">const</span> <a class="code" href="classPxTransform.html" title="class representing a rigid euclidean transform as a quaternion and a vector">PxTransform</a>* transforms, <span class="keyword">const</span> <a class="code" href="namespacephysx.html#9b7fbd746d18bf5b6545713a8d818f41">PxU32</a> count)
<a name="l00292"></a>00292     {
<a name="l00293"></a>00293         <a class="code" href="namespacephysx.html#727d2d8426e2a21ebbc522fa65c3f97a">PxReal</a> combinedMass = 0.0f;
<a name="l00294"></a>00294         <a class="code" href="classPxVec3.html" title="3 Element vector class.">PxVec3</a> combinedCoM(0.0f);
<a name="l00295"></a>00295         <a class="code" href="classPxMat33.html" title="3x3 matrix class">PxMat33</a> combinedInertiaT = <a class="code" href="classPxMat33.html" title="3x3 matrix class">PxMat33</a>(<a class="code" href="group__foundation.html#ggc10bd69c94c165a52f6de39678ef9d4c0ea259a79d3556f2986a96b5fbf8d4bc">PxZero</a>);
<a name="l00296"></a>00296 
<a name="l00297"></a>00297         <span class="keywordflow">for</span>(<a class="code" href="namespacephysx.html#9b7fbd746d18bf5b6545713a8d818f41">PxU32</a> i = 0; i &lt; count; i++)
<a name="l00298"></a>00298         {
<a name="l00299"></a>00299             <a class="code" href="group__foundation.html#g4a83a657390b324a460f14684e5accee">PX_ASSERT</a>(props[i].inertiaTensor.column0.isFinite() &amp;&amp; props[i].<a class="code" href="classPxMassProperties.html#eefe4de17f788dacbf9c48fd5ec857ac" title="The inertia tensor of the object.">inertiaTensor</a>.<a class="code" href="classPxMat33.html#62f190479e12e7b9ec5cf831b23c95e9">column1</a>.<a class="code" href="classPxVec3.html#65b6f42ac7654a7d79590a2f1d00e160" title="returns true if all 3 elems of the vector are finite (not NAN or INF, etc.)">isFinite</a>() &amp;&amp; props[i].<a class="code" href="classPxMassProperties.html#eefe4de17f788dacbf9c48fd5ec857ac" title="The inertia tensor of the object.">inertiaTensor</a>.<a class="code" href="classPxMat33.html#9af2a3d4f9cca979c3e46a6406de6957">column2</a>.<a class="code" href="classPxVec3.html#65b6f42ac7654a7d79590a2f1d00e160" title="returns true if all 3 elems of the vector are finite (not NAN or INF, etc.)">isFinite</a>());
<a name="l00300"></a>00300             <a class="code" href="group__foundation.html#g4a83a657390b324a460f14684e5accee">PX_ASSERT</a>(props[i].centerOfMass.isFinite());
<a name="l00301"></a>00301             <a class="code" href="group__foundation.html#g4a83a657390b324a460f14684e5accee">PX_ASSERT</a>(<a class="code" href="group__foundation.html#gd6de0f4af98c5c5280b8fe695dc87318" title="returns true if the passed number is a finite floating point number as opposed to...">PxIsFinite</a>(props[i].mass));
<a name="l00302"></a>00302 
<a name="l00303"></a>00303             combinedMass += props[i].<a class="code" href="classPxMassProperties.html#978392fb04bb472602f9fc1315d5f116" title="The mass of the object.">mass</a>;
<a name="l00304"></a>00304             <span class="keyword">const</span> <a class="code" href="classPxVec3.html" title="3 Element vector class.">PxVec3</a> comTm = transforms[i].<a class="code" href="classPxTransform.html#ee2fa4f5d0f6a1bad831fe0c81094ebd">transform</a>(props[i].centerOfMass);
<a name="l00305"></a>00305             combinedCoM += comTm * props[i].<a class="code" href="classPxMassProperties.html#978392fb04bb472602f9fc1315d5f116" title="The mass of the object.">mass</a>;
<a name="l00306"></a>00306         }
<a name="l00307"></a>00307 
<a name="l00308"></a>00308         combinedCoM /= combinedMass;
<a name="l00309"></a>00309 
<a name="l00310"></a>00310         <span class="keywordflow">for</span>(<a class="code" href="namespacephysx.html#9b7fbd746d18bf5b6545713a8d818f41">PxU32</a> i = 0; i &lt; count; i++)
<a name="l00311"></a>00311         {
<a name="l00312"></a>00312             <span class="keyword">const</span> <a class="code" href="classPxVec3.html" title="3 Element vector class.">PxVec3</a> comTm = transforms[i].<a class="code" href="classPxTransform.html#ee2fa4f5d0f6a1bad831fe0c81094ebd">transform</a>(props[i].centerOfMass);
<a name="l00313"></a>00313             combinedInertiaT += translateInertia(rotateInertia(props[i].inertiaTensor, transforms[i].q), props[i].mass, combinedCoM - comTm);
<a name="l00314"></a>00314         }
<a name="l00315"></a>00315 
<a name="l00316"></a>00316         <a class="code" href="group__foundation.html#g4a83a657390b324a460f14684e5accee">PX_ASSERT</a>(combinedInertiaT.<a class="code" href="classPxMat33.html#89d12d4e50ffc5ef8e480bdd3dadb78a">column0</a>.<a class="code" href="classPxVec3.html#65b6f42ac7654a7d79590a2f1d00e160" title="returns true if all 3 elems of the vector are finite (not NAN or INF, etc.)">isFinite</a>() &amp;&amp; combinedInertiaT.<a class="code" href="classPxMat33.html#62f190479e12e7b9ec5cf831b23c95e9">column1</a>.<a class="code" href="classPxVec3.html#65b6f42ac7654a7d79590a2f1d00e160" title="returns true if all 3 elems of the vector are finite (not NAN or INF, etc.)">isFinite</a>() &amp;&amp; combinedInertiaT.<a class="code" href="classPxMat33.html#9af2a3d4f9cca979c3e46a6406de6957">column2</a>.<a class="code" href="classPxVec3.html#65b6f42ac7654a7d79590a2f1d00e160" title="returns true if all 3 elems of the vector are finite (not NAN or INF, etc.)">isFinite</a>());
<a name="l00317"></a>00317         <a class="code" href="group__foundation.html#g4a83a657390b324a460f14684e5accee">PX_ASSERT</a>(combinedCoM.<a class="code" href="classPxVec3.html#65b6f42ac7654a7d79590a2f1d00e160" title="returns true if all 3 elems of the vector are finite (not NAN or INF, etc.)">isFinite</a>());
<a name="l00318"></a>00318         <a class="code" href="group__foundation.html#g4a83a657390b324a460f14684e5accee">PX_ASSERT</a>(<a class="code" href="group__foundation.html#gd6de0f4af98c5c5280b8fe695dc87318" title="returns true if the passed number is a finite floating point number as opposed to...">PxIsFinite</a>(combinedMass));
<a name="l00319"></a>00319 
<a name="l00320"></a>00320         <span class="keywordflow">return</span> <a class="code" href="classPxMassProperties.html" title="Utility class to compute and manipulate mass and inertia tensor properties.">PxMassProperties</a>(combinedMass, combinedInertiaT, combinedCoM);
<a name="l00321"></a>00321     }
<a name="l00322"></a>00322 
<a name="l00323"></a>00323 
<a name="l00324"></a><a class="code" href="classPxMassProperties.html#eefe4de17f788dacbf9c48fd5ec857ac">00324</a>     <a class="code" href="classPxMat33.html" title="3x3 matrix class">PxMat33</a> inertiaTensor;          
<a name="l00325"></a><a class="code" href="classPxMassProperties.html#8f4e5b19248941b3ee2369afadb20e96">00325</a>     <a class="code" href="classPxVec3.html" title="3 Element vector class.">PxVec3</a>  centerOfMass;           
<a name="l00326"></a><a class="code" href="classPxMassProperties.html#978392fb04bb472602f9fc1315d5f116">00326</a>     <a class="code" href="namespacephysx.html#727d2d8426e2a21ebbc522fa65c3f97a">PxReal</a>  mass;                   
<a name="l00327"></a>00327 };
<a name="l00328"></a>00328 
<a name="l00329"></a>00329 <span class="preprocessor">#if !PX_DOXYGEN</span>
<a name="l00330"></a>00330 <span class="preprocessor"></span>} <span class="comment">// namespace physx</span>
<a name="l00331"></a>00331 <span class="preprocessor">#endif</span>
<a name="l00332"></a>00332 <span class="preprocessor"></span>
<a name="l00334"></a>00334 <span class="preprocessor">#endif</span>
</pre></div></div>

<hr style="width: 100%; height: 2px;"><br>
Copyright &copy; 2008-2018 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>
</body>
</html>