本文整理汇总了C++中NxMat33::getInverse方法的典型用法代码示例。如果您正苦于以下问题:C++ NxMat33::getInverse方法的具体用法?C++ NxMat33::getInverse怎么用?C++ NxMat33::getInverse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NxMat33
的用法示例。
在下文中一共展示了NxMat33::getInverse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IMakePolytope
hsVectorStream* plPhysXCooking::IMakePolytope(const plMaxMeshExtractor::NeutralMesh& inMesh)
{
hsBool success=0;
std::vector<hsPoint3> outCloud;
hsPoint3 offset;
int numPlanes=26;
float planeMax[26];
int indexMax[26];
hsPoint3 AABBMin(FLT_MAX,FLT_MAX,FLT_MAX);
hsPoint3 AABBMax(-FLT_MAX,-FLT_MAX,-FLT_MAX);
//prep
NxVec3* vectors = new NxVec3[26];
int curvec=0;
for(int xcomp= -1;xcomp<2;xcomp++)
{
for(int ycomp= -1;ycomp<2;ycomp++)
{
for(int zcomp= -1;zcomp<2;zcomp++)
{
if(!((xcomp==0)&&(ycomp==0)&&(zcomp==0)))
{
vectors[curvec].set((float)(xcomp),(float)(ycomp),(float)(zcomp));
vectors[curvec].normalize();
planeMax[curvec]=(-FLT_MAX);
//indexMax[curvec]=0;
curvec++;
}
}
}
}
/*
for(int i=0;i<26;i++)
{//make your max and mins
planeMax[i]=(-FLT_MAX);
}
*/
hsPoint3 centroid(0.0f,0.0f,0.0f);
for(int i=0;i<inMesh.fNumVerts;i++) centroid+=inMesh.fVerts[i];
centroid=centroid/(float)inMesh.fNumVerts;
//temp
NxVec3* nxLocs=new NxVec3[inMesh.fNumVerts];
NxVec3* nxLocs2=new NxVec3[inMesh.fNumVerts];
for(int i=0;i<inMesh.fNumVerts;i++)
{
hsPoint3 temppt=inMesh.fVerts[i] - centroid;
nxLocs[i]=plPXConvert::Point(temppt);
}
NxMat33 rot;
NxVec3 eigen;
PCA(nxLocs,inMesh.fNumVerts,rot);
NxMat33 invrot;
rot.getInverse(invrot);
for(int i=0; i<inMesh.fNumVerts;i++)
{
nxLocs2[i]=invrot*nxLocs[i];
}
for(int i=0;i<inMesh.fNumVerts;i++)
{
for(int plane=0;plane<26;plane++)
{
float dist=nxLocs2[i].dot(vectors[plane]);
if(dist>=planeMax[plane])
{
planeMax[plane]=dist;
indexMax[plane]=i;
}
}
}
for(int i=0;i<inMesh.fNumVerts;i++)
{
AABBMin.fX = hsMinimum(nxLocs2[i].x, AABBMin.fX);
AABBMin.fY = hsMinimum(nxLocs2[i].y, AABBMin.fY);
AABBMin.fZ = hsMinimum(nxLocs2[i].z, AABBMin.fZ);
AABBMax.fX = hsMaximum(nxLocs2[i].x, AABBMax.fX);
AABBMax.fY = hsMaximum(nxLocs2[i].y, AABBMax.fY);
AABBMax.fZ = hsMaximum(nxLocs2[i].z, AABBMax.fZ);
}
int resultingPoints=0;
for(int i=0;i<26;i++)
{
for(int j=0;j<26;j++)
{
for(int k=0;k<26;k++)
{
NxVec3 res;
if(ThreePlaneIntersect(vectors[i],nxLocs2[indexMax[i]],vectors[j],nxLocs2[indexMax[j]], vectors[k],nxLocs2[indexMax[k]],res))
{
//check it is within all slabs
bool within=true;
int curplane=0;
do
{
float intersecdist=res.dot(vectors[curplane]);
if((intersecdist-planeMax[curplane])>0.0001)
{
within=false;
//.........这里部分代码省略.........