7 #ifndef PXR_USD_USD_MASS_PROPERTIES_H 
    8 #define PXR_USD_USD_MASS_PROPERTIES_H 
   24     float v[3] = { 0, 0, 0 };
 
   26     return GfQuatf(c, v[0], v[1], v[2]);
 
   31     return (i + 1 + (i >> 1)) & 3;
 
   37     const uint32_t MAX_ITERS = 24;
 
   42     for (uint32_t i = 0; i < MAX_ITERS; i++)
 
   47         float d0 = fabs(d[1][2]), d1 = fabs(d[0][2]), d2 = fabs(d[0][1]);
 
   48         uint32_t 
a = uint32_t(d0 > d1 && d0 > d2 ? 0 : d1 > d2 ? 1 : 2); 
 
   53         if (d[a1][a2] == 0.0
f || fabs(d[a1][a1] - d[a2][a2]) > 2e6 * fabs(2.0 * d[a1][a2]))
 
   56         float w = (d[a1][a1] - d[a2][a2]) / (2.0
f * d[a1][a2]); 
 
   64             float t = 1 / (absw + 
sqrt(w * w + 1)); 
 
   65             float h = 1 / 
sqrt(t * t + 1); 
 
   70         q = (q * 
r).GetNormalized();
 
   93         _inertiaTensor[0][0] = 1.0;
 
   94         _inertiaTensor[1][1] = 1.0;
 
   95         _inertiaTensor[2][2] = 1.0;
 
  100         : _inertiaTensor(inertiaT), _centerOfMass(com), _mass(m)
 
  166         float combinedMass = 0.0f;
 
  170         for (uint32_t i = 0; i < 
count; i++)
 
  172             combinedMass += props[i]._mass;
 
  174             combinedCoM += comTm * props[i]._mass;
 
  177         if (combinedMass > 0.
f)
 
  178             combinedCoM /= combinedMass;
 
  180         for (uint32_t i = 0; i < 
count; i++)
 
  185                 props[i]._mass, combinedCoM - comTm);
 
  195         return _inertiaTensor;
 
  202         _inertiaTensor = inTensor;
 
  209         return _centerOfMass;
 
PXR_NAMESPACE_OPEN_SCOPE GfQuatf UsdPhysicsIndexedRotation(uint32_t axis, float s, float c)
static USDPHYSICS_API UsdPhysicsMassProperties Sum(const UsdPhysicsMassProperties *props, const GfMatrix4f *transforms, const uint32_t count)
vfloat4 sqrt(const vfloat4 &a)
static USDPHYSICS_API GfMatrix3f RotateInertia(const GfMatrix3f &inertia, const GfQuatf &q)
GLboolean GLboolean GLboolean GLboolean a
static USDPHYSICS_API GfVec3f GetMassSpaceInertia(const GfMatrix3f &inertia, GfQuatf &massFrame)
GA_API const UT_StringHolder com
GF_API GfMatrix3f GetTranspose() const 
Returns the transpose of the matrix. 
GLdouble GLdouble GLdouble q
GfVec3f UsdPhysicsDiagonalize(const GfMatrix3f &m, GfQuatf &massFrame)
GA_API const UT_StringHolder scale
void SetMass(float inMass)
const GfVec3f & GetCenterOfMass() const 
USDPHYSICS_API void Translate(const GfVec3f &t)
GfVec3d Transform(const GfVec3d &vec) const 
uint32_t UsdPhysicsGetNextIndex3(uint32_t i)
GfVec3f GetColumn(int i) const 
Gets a column of the matrix as a Vec3. 
USDPHYSICS_API UsdPhysicsMassProperties operator*(const float scale) const 
USDPHYSICS_API UsdPhysicsMassProperties(const float m, const GfMatrix3f &inertiaT, const GfVec3f &com)
Construct from individual elements. 
GA_API const UT_StringHolder mass
GLfloat GLfloat GLfloat GLfloat h
void SetInertiaTensor(const GfMatrix3f &inTensor)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
#define PXR_NAMESPACE_CLOSE_SCOPE
const GfMatrix3f & GetInertiaTensor() const 
GLubyte GLubyte GLubyte GLubyte w
static USDPHYSICS_API GfMatrix3f TranslateInertia(const GfMatrix3f &inertia, const float mass, const GfVec3f &t)
void SetColumn(int i, const GfVec3f &v)
Sets a column of the matrix from a Vec3. 
USDPHYSICS_API UsdPhysicsMassProperties()
Construct a MassProperties. 
GLenum GLuint GLsizei const GLenum * props