aboutsummaryrefslogtreecommitdiff
path: root/PhysX_3.4/Documentation/PhysXAPI/files/PxMeshScale_8h-source.html
blob: a690f982a125ee967ea649e7cfbc9a6e153f43cb (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
<html>
	<head>
		<title>NVIDIA(R) PhysX(R) SDK 3.4 API Reference: PxMeshScale.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>PxMeshScale.h</h1><a href="PxMeshScale_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// This code contains NVIDIA Confidential Information and is disclosed to you</span>
<a name="l00002"></a>00002 <span class="comment">// under a form of NVIDIA software license agreement provided separately to you.</span>
<a name="l00003"></a>00003 <span class="comment">//</span>
<a name="l00004"></a>00004 <span class="comment">// Notice</span>
<a name="l00005"></a>00005 <span class="comment">// NVIDIA Corporation and its licensors retain all intellectual property and</span>
<a name="l00006"></a>00006 <span class="comment">// proprietary rights in and to this software and related documentation and</span>
<a name="l00007"></a>00007 <span class="comment">// any modifications thereto. Any use, reproduction, disclosure, or</span>
<a name="l00008"></a>00008 <span class="comment">// distribution of this software and related documentation without an express</span>
<a name="l00009"></a>00009 <span class="comment">// license agreement from NVIDIA Corporation is strictly prohibited.</span>
<a name="l00010"></a>00010 <span class="comment">//</span>
<a name="l00011"></a>00011 <span class="comment">// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES</span>
<a name="l00012"></a>00012 <span class="comment">// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO</span>
<a name="l00013"></a>00013 <span class="comment">// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,</span>
<a name="l00014"></a>00014 <span class="comment">// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.</span>
<a name="l00015"></a>00015 <span class="comment">//</span>
<a name="l00016"></a>00016 <span class="comment">// Information and code furnished is believed to be accurate and reliable.</span>
<a name="l00017"></a>00017 <span class="comment">// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such</span>
<a name="l00018"></a>00018 <span class="comment">// information or for any infringement of patents or other rights of third parties that may</span>
<a name="l00019"></a>00019 <span class="comment">// result from its use. No license is granted by implication or otherwise under any patent</span>
<a name="l00020"></a>00020 <span class="comment">// or patent rights of NVIDIA Corporation. Details are subject to change without notice.</span>
<a name="l00021"></a>00021 <span class="comment">// This code supersedes and replaces all information previously supplied.</span>
<a name="l00022"></a>00022 <span class="comment">// NVIDIA Corporation products are not authorized for use as critical</span>
<a name="l00023"></a>00023 <span class="comment">// components in life support devices or systems without express written approval of</span>
<a name="l00024"></a>00024 <span class="comment">// NVIDIA Corporation.</span>
<a name="l00025"></a>00025 <span class="comment">//</span>
<a name="l00026"></a>00026 <span class="comment">// Copyright (c) 2008-2017 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_NX_MESHSCALE</span>
<a name="l00032"></a>00032 <span class="preprocessor"></span><span class="preprocessor">#define PX_PHYSICS_NX_MESHSCALE</span>
<a name="l00033"></a>00033 <span class="preprocessor"></span>
<a name="l00037"></a>00037 <span class="preprocessor">#include "<a class="code" href="PxPhysXCommonConfig_8h.html">common/PxPhysXCommonConfig.h</a>"</span>
<a name="l00038"></a>00038 <span class="preprocessor">#include "<a class="code" href="PxMat33_8h.html">foundation/PxMat33.h</a>"</span>
<a name="l00039"></a>00039 <span class="preprocessor">#include "<a class="code" href="PxAssert_8h.html">foundation/PxAssert.h</a>"</span>
<a name="l00040"></a>00040 
<a name="l00043"></a><a class="code" href="group__geomutils.html#g5be09a494ce1f8aa8e8b986e82fc06d8">00043</a> <span class="preprocessor">#define PX_MESH_SCALE_MIN 1e-6f</span>
<a name="l00044"></a>00044 <span class="preprocessor"></span>
<a name="l00047"></a><a class="code" href="group__geomutils.html#gaaa6a4b8b94e1bcce0bedb92d873b57e">00047</a> <span class="preprocessor">#define PX_MESH_SCALE_MAX 1e6f</span>
<a name="l00048"></a>00048 <span class="preprocessor"></span>
<a name="l00049"></a>00049 <span class="preprocessor">#if !PX_DOXYGEN</span>
<a name="l00050"></a>00050 <span class="preprocessor"></span><span class="keyword">namespace </span>physx
<a name="l00051"></a>00051 {
<a name="l00052"></a>00052 <span class="preprocessor">#endif</span>
<a name="l00053"></a>00053 <span class="preprocessor"></span>
<a name="l00068"></a><a class="code" href="classPxMeshScale.html">00068</a> <span class="keyword">class </span><a class="code" href="classPxMeshScale.html" title="A class expressing a nonuniform scaling transformation.">PxMeshScale</a>
<a name="l00069"></a>00069 {
<a name="l00070"></a>00070 <span class="comment">//= ATTENTION! =====================================================================================</span>
<a name="l00071"></a>00071 <span class="comment">// Changing the data layout of this class breaks the binary serialization format.  See comments for </span>
<a name="l00072"></a>00072 <span class="comment">// PX_BINARY_SERIAL_VERSION.  If a modification is required, please adjust the getBinaryMetaData </span>
<a name="l00073"></a>00073 <span class="comment">// function.  If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION</span>
<a name="l00074"></a>00074 <span class="comment">// accordingly.</span>
<a name="l00075"></a>00075 <span class="comment">//==================================================================================================</span>
<a name="l00076"></a>00076 <span class="keyword">public</span>:
<a name="l00080"></a><a class="code" href="classPxMeshScale.html#e61dcd43ff73b52319a187e029906657">00080</a>     <a class="code" href="group__foundation.html#g6e444d58dbf1459261fadc9b79594f63">PX_CUDA_CALLABLE</a> <a class="code" href="group__foundation.html#g6a774eed3cad34b0f636332a3d28c6bb">PX_FORCE_INLINE</a> <a class="code" href="classPxMeshScale.html" title="A class expressing a nonuniform scaling transformation.">PxMeshScale</a>(): scale(1.0f), rotation(<a class="code" href="group__foundation.html#gg70160ca5bbafef277790b3e0f12baf3895e14c69af8048aedd218cd6e96ad50f">PxIdentity</a>) 
<a name="l00081"></a>00081     {
<a name="l00082"></a>00082     }
<a name="l00083"></a>00083 
<a name="l00087"></a><a class="code" href="classPxMeshScale.html#073dcde32362dd33ba16db1375d32ded">00087</a>     <span class="keyword">explicit</span> <a class="code" href="group__foundation.html#g6e444d58dbf1459261fadc9b79594f63">PX_CUDA_CALLABLE</a> <a class="code" href="group__foundation.html#g6a774eed3cad34b0f636332a3d28c6bb">PX_FORCE_INLINE</a> <a class="code" href="classPxMeshScale.html" title="A class expressing a nonuniform scaling transformation.">PxMeshScale</a>(<a class="code" href="namespacephysx.html#727d2d8426e2a21ebbc522fa65c3f97a">PxReal</a> r): scale(r), rotation(<a class="code" href="group__foundation.html#gg70160ca5bbafef277790b3e0f12baf3895e14c69af8048aedd218cd6e96ad50f">PxIdentity</a>) 
<a name="l00088"></a>00088     {
<a name="l00089"></a>00089     }
<a name="l00090"></a>00090 
<a name="l00094"></a><a class="code" href="classPxMeshScale.html#861aff2d78563d1e844d5cb6a34057c6">00094</a>     <a class="code" href="group__foundation.html#g6e444d58dbf1459261fadc9b79594f63">PX_CUDA_CALLABLE</a> <a class="code" href="group__foundation.html#g6a774eed3cad34b0f636332a3d28c6bb">PX_FORCE_INLINE</a> <a class="code" href="classPxMeshScale.html" title="A class expressing a nonuniform scaling transformation.">PxMeshScale</a>(<span class="keyword">const</span> <a class="code" href="classPxVec3.html" title="3 Element vector class.">PxVec3</a>&amp; s)
<a name="l00095"></a>00095     {
<a name="l00096"></a>00096         scale = s;
<a name="l00097"></a>00097         rotation = <a class="code" href="classPxQuat.html" title="This is a quaternion class. For more information on quaternion mathematics consult...">PxQuat</a>(<a class="code" href="group__foundation.html#gg70160ca5bbafef277790b3e0f12baf3895e14c69af8048aedd218cd6e96ad50f">PxIdentity</a>);
<a name="l00098"></a>00098     }
<a name="l00099"></a>00099 
<a name="l00103"></a><a class="code" href="classPxMeshScale.html#5187c2f3e63fea4fc8913630429779c3">00103</a>     <a class="code" href="group__foundation.html#g6e444d58dbf1459261fadc9b79594f63">PX_CUDA_CALLABLE</a> <a class="code" href="group__foundation.html#g6a774eed3cad34b0f636332a3d28c6bb">PX_FORCE_INLINE</a> <a class="code" href="classPxMeshScale.html" title="A class expressing a nonuniform scaling transformation.">PxMeshScale</a>(<span class="keyword">const</span> <a class="code" href="classPxVec3.html" title="3 Element vector class.">PxVec3</a>&amp; s, <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; r)
<a name="l00104"></a>00104     {
<a name="l00105"></a>00105         <a class="code" href="group__foundation.html#g4a83a657390b324a460f14684e5accee">PX_ASSERT</a>(r.<a class="code" href="classPxQuat.html#3890ca4efba038ab0fc84bb39c5267db" title="returns true if finite and magnitude is close to unit">isUnit</a>());
<a name="l00106"></a>00106         scale = s;
<a name="l00107"></a>00107         rotation = r;
<a name="l00108"></a>00108     }
<a name="l00109"></a>00109 
<a name="l00110"></a>00110 
<a name="l00114"></a><a class="code" href="classPxMeshScale.html#8f7835837651faf5b74d3ee94b6901d7">00114</a>     <a class="code" href="group__foundation.html#g6e444d58dbf1459261fadc9b79594f63">PX_CUDA_CALLABLE</a> <a class="code" href="group__foundation.html#g6a774eed3cad34b0f636332a3d28c6bb">PX_FORCE_INLINE</a> <span class="keywordtype">bool</span> isIdentity()<span class="keyword">  const</span>
<a name="l00115"></a>00115 <span class="keyword">    </span>{
<a name="l00116"></a>00116         <span class="keywordflow">return</span> (scale.x == 1.0f &amp;&amp; scale.y == 1.0f &amp;&amp; scale.z == 1.0f);
<a name="l00117"></a>00117     }
<a name="l00118"></a>00118 
<a name="l00122"></a><a class="code" href="classPxMeshScale.html#b6a550b31ba9d77b00400cbb7126a7b5">00122</a>     <a class="code" href="group__foundation.html#g6e444d58dbf1459261fadc9b79594f63">PX_CUDA_CALLABLE</a> <a class="code" href="group__foundation.html#g6a774eed3cad34b0f636332a3d28c6bb">PX_FORCE_INLINE</a>  <a class="code" href="classPxMeshScale.html" title="A class expressing a nonuniform scaling transformation.">PxMeshScale</a> getInverse()<span class="keyword"> const </span>
<a name="l00123"></a>00123 <span class="keyword">    </span>{
<a name="l00124"></a>00124         <span class="keywordflow">return</span> <a class="code" href="classPxMeshScale.html" title="A class expressing a nonuniform scaling transformation.">PxMeshScale</a>(<a class="code" href="classPxVec3.html" title="3 Element vector class.">PxVec3</a>(1.0f/scale.x, 1.0f/scale.y, 1.0f/scale.z), rotation);
<a name="l00125"></a>00125     }
<a name="l00126"></a>00126 
<a name="l00130"></a><a class="code" href="classPxMeshScale.html#e2b26c0cb36188e42f532f8c22024a71">00130</a>     <a class="code" href="group__foundation.html#g6e444d58dbf1459261fadc9b79594f63">PX_CUDA_CALLABLE</a> <a class="code" href="group__foundation.html#g6a774eed3cad34b0f636332a3d28c6bb">PX_FORCE_INLINE</a> <a class="code" href="classPxMat33.html" title="3x3 matrix class">PxMat33</a> toMat33()<span class="keyword"> const </span>
<a name="l00131"></a>00131 <span class="keyword">    </span>{
<a name="l00132"></a>00132         <a class="code" href="classPxMat33.html" title="3x3 matrix class">PxMat33</a> rot(rotation);
<a name="l00133"></a>00133         <a class="code" href="classPxMat33.html" title="3x3 matrix class">PxMat33</a> trans = rot.<a class="code" href="classPxMat33.html#4ac2e5e46952e91a18126a5de02d2697" title="Get transposed matrix.">getTranspose</a>();
<a name="l00134"></a>00134         trans.<a class="code" href="classPxMat33.html#89d12d4e50ffc5ef8e480bdd3dadb78a">column0</a> *= scale[0];
<a name="l00135"></a>00135         trans.<a class="code" href="classPxMat33.html#62f190479e12e7b9ec5cf831b23c95e9">column1</a> *= scale[1];
<a name="l00136"></a>00136         trans.<a class="code" href="classPxMat33.html#9af2a3d4f9cca979c3e46a6406de6957">column2</a> *= scale[2];
<a name="l00137"></a>00137         <span class="keywordflow">return</span> trans * rot;
<a name="l00138"></a>00138     }
<a name="l00139"></a>00139 
<a name="l00143"></a><a class="code" href="classPxMeshScale.html#97297ffe7d5de702b70df7e3c7050274">00143</a>     <a class="code" href="group__foundation.html#g6e444d58dbf1459261fadc9b79594f63">PX_CUDA_CALLABLE</a> <a class="code" href="group__foundation.html#g6a774eed3cad34b0f636332a3d28c6bb">PX_FORCE_INLINE</a> <span class="keywordtype">bool</span> hasNegativeDeterminant()<span class="keyword"> const</span>
<a name="l00144"></a>00144 <span class="keyword">    </span>{
<a name="l00145"></a>00145         <span class="keywordflow">return</span> (scale.x * scale.y * scale.z &lt; 0.0f);
<a name="l00146"></a>00146     }
<a name="l00147"></a>00147 
<a name="l00148"></a><a class="code" href="classPxMeshScale.html#9750f18491c9bff546f62b7f999883df">00148</a>     <a class="code" href="classPxVec3.html" title="3 Element vector class.">PxVec3</a>      transform(<span class="keyword">const</span> <a class="code" href="classPxVec3.html" title="3 Element vector class.">PxVec3</a>&amp; v)<span class="keyword"> const</span>
<a name="l00149"></a>00149 <span class="keyword">    </span>{
<a name="l00150"></a>00150         <span class="keywordflow">return</span> rotation.rotateInv(scale.multiply(rotation.rotate(v)));
<a name="l00151"></a>00151     }
<a name="l00152"></a>00152 
<a name="l00153"></a><a class="code" href="classPxMeshScale.html#6c8b93430301371e3c5c60fed3e53c3b">00153</a>     <span class="keywordtype">bool</span>        isValidForTriangleMesh()<span class="keyword"> const</span>
<a name="l00154"></a>00154 <span class="keyword">    </span>{
<a name="l00155"></a>00155         <a class="code" href="classPxVec3.html" title="3 Element vector class.">PxVec3</a> absXYZ = scale.abs();
<a name="l00156"></a>00156         <span class="keywordflow">return</span> (absXYZ.<a class="code" href="classPxVec3.html#6f31dfee4f75a05884c6e4f511e21142" title="returns MAX(x, y, z);">maxElement</a>() &lt;= <a class="code" href="group__geomutils.html#gaaa6a4b8b94e1bcce0bedb92d873b57e" title="Maximum allowed absolute magnitude for each of mesh scale&amp;#39;s components (x,y,z)...">PX_MESH_SCALE_MAX</a>) &amp;&amp; (absXYZ.<a class="code" href="classPxVec3.html#cb26d5ad522e925245a3b16f76df4b51" title="returns MIN(x, y, z);">minElement</a>() &gt;= <a class="code" href="group__geomutils.html#g5be09a494ce1f8aa8e8b986e82fc06d8" title="Minimum allowed absolute magnitude for each of mesh scale&amp;#39;s components (x,y,z)...">PX_MESH_SCALE_MIN</a>);
<a name="l00157"></a>00157     }
<a name="l00158"></a>00158 
<a name="l00159"></a><a class="code" href="classPxMeshScale.html#4101dcecd21337bd95b3ca1fb52d1e1d">00159</a>     <span class="keywordtype">bool</span>        isValidForConvexMesh()<span class="keyword"> const</span>
<a name="l00160"></a>00160 <span class="keyword">    </span>{
<a name="l00161"></a>00161         <span class="keywordflow">return</span> (scale.maxElement() &lt;= <a class="code" href="group__geomutils.html#gaaa6a4b8b94e1bcce0bedb92d873b57e" title="Maximum allowed absolute magnitude for each of mesh scale&amp;#39;s components (x,y,z)...">PX_MESH_SCALE_MAX</a>) &amp;&amp; (scale.minElement() &gt;= <a class="code" href="group__geomutils.html#g5be09a494ce1f8aa8e8b986e82fc06d8" title="Minimum allowed absolute magnitude for each of mesh scale&amp;#39;s components (x,y,z)...">PX_MESH_SCALE_MIN</a>);
<a name="l00162"></a>00162     }
<a name="l00163"></a>00163 
<a name="l00164"></a><a class="code" href="classPxMeshScale.html#12f2dbcf5214c4c5956dab0e75831449">00164</a>     <a class="code" href="classPxVec3.html" title="3 Element vector class.">PxVec3</a>      scale;      
<a name="l00165"></a><a class="code" href="classPxMeshScale.html#63902c04c9a3f326b5f969fa931e53fd">00165</a>     <a class="code" href="classPxQuat.html" title="This is a quaternion class. For more information on quaternion mathematics consult...">PxQuat</a>      rotation;   
<a name="l00166"></a>00166 
<a name="l00167"></a>00167 
<a name="l00168"></a>00168 };
<a name="l00169"></a>00169 
<a name="l00170"></a>00170 <span class="preprocessor">#if !PX_DOXYGEN</span>
<a name="l00171"></a>00171 <span class="preprocessor"></span>} <span class="comment">// namespace physx</span>
<a name="l00172"></a>00172 <span class="preprocessor">#endif</span>
<a name="l00173"></a>00173 <span class="preprocessor"></span>
<a name="l00175"></a>00175 <span class="preprocessor">#endif</span>
</pre></div></div>

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