Back to index

supertuxkart  0.5+dfsg1
Public Member Functions | Private Member Functions | Private Attributes
HullLibrary Class Reference

#include <btConvexHull.h>

Collaboration diagram for HullLibrary:
Collaboration graph
[legend]

List of all members.

Public Member Functions

HullError CreateConvexHull (const HullDesc &desc, HullResult &result)
HullError ReleaseResult (HullResult &result)

Private Member Functions

bool ComputeHull (unsigned int vcount, const btVector3 *vertices, PHullResult &result, unsigned int vlimit)
class TriallocateTriangle (int a, int b, int c)
void deAllocateTriangle (Tri *)
void b2bfix (Tri *s, Tri *t)
void removeb2b (Tri *s, Tri *t)
void checkit (Tri *t)
Triextrudable (btScalar epsilon)
int calchull (btVector3 *verts, int verts_count, TUIntArray &tris_out, int &tris_count, int vlimit)
int calchullgen (btVector3 *verts, int verts_count, int vlimit)
int4 FindSimplex (btVector3 *verts, int verts_count, btAlignedObjectArray< int > &allow)
class ConvexHConvexHCrop (ConvexH &convex, const btPlane &slice)
void extrude (class Tri *t0, int v)
ConvexHtest_cube ()
void BringOutYourDead (const btVector3 *verts, unsigned int vcount, btVector3 *overts, unsigned int &ocount, unsigned int *indices, unsigned indexcount)
bool CleanupVertices (unsigned int svcount, const btVector3 *svertices, unsigned int stride, unsigned int &vcount, btVector3 *vertices, btScalar normalepsilon, btVector3 &scale)

Private Attributes

btAlignedObjectArray< class Tri * > m_tris

Detailed Description

Definition at line 186 of file btConvexHull.h.


Member Function Documentation

Tri * HullLibrary::allocateTriangle ( int  a,
int  b,
int  c 
) [private]

Definition at line 414 of file btConvexHull.cpp.

{
       void* mem = btAlignedAlloc(sizeof(Tri),16);
       Tri* tr = new (mem)Tri(a,b,c);
       tr->id = m_tris.size();
       m_tris.push_back(tr);

       return tr;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void HullLibrary::b2bfix ( Tri s,
Tri t 
) [private]

Definition at line 375 of file btConvexHull.cpp.

{
       int i;
       for(i=0;i<3;i++) 
       {
              int i1=(i+1)%3;
              int i2=(i+2)%3;
              int a = (*s)[i1];
              int b = (*s)[i2];
              btAssert(m_tris[s->neib(a,b)]->neib(b,a) == s->id);
              btAssert(m_tris[t->neib(a,b)]->neib(b,a) == t->id);
              m_tris[s->neib(a,b)]->neib(b,a) = t->neib(b,a);
              m_tris[t->neib(b,a)]->neib(a,b) = s->neib(a,b);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void HullLibrary::BringOutYourDead ( const btVector3 verts,
unsigned int  vcount,
btVector3 overts,
unsigned int &  ocount,
unsigned int *  indices,
unsigned  indexcount 
) [private]

Definition at line 1100 of file btConvexHull.cpp.

{
       TUIntArray usedIndices;
       usedIndices.resize(vcount);
       memset(&usedIndices[0],0,sizeof(unsigned int)*vcount);

       ocount = 0;

       for (unsigned int i=0; i<indexcount; i++)
       {
              unsigned int v = indices[i]; // original array index

              btAssert( v >= 0 && v < vcount );

              if ( usedIndices[v] ) // if already remapped
              {
                     indices[i] = usedIndices[v]-1; // index to new array
              }
              else
              {

                     indices[i] = ocount;      // new index mapping

                     overts[ocount][0] = verts[v][0]; // copy old vert to new vert array
                     overts[ocount][1] = verts[v][1];
                     overts[ocount][2] = verts[v][2];

                     ocount++; // increment output vert count

                     btAssert( ocount >=0 && ocount <= vcount );

                     usedIndices[v] = ocount; // assign new index remapping
              }
       }

       
}

Here is the call graph for this function:

Here is the caller graph for this function:

int HullLibrary::calchull ( btVector3 verts,
int  verts_count,
TUIntArray tris_out,
int &  tris_count,
int  vlimit 
) [private]

Definition at line 609 of file btConvexHull.cpp.

{
       int rc=calchullgen(verts,verts_count,  vlimit) ;
       if(!rc) return 0;
       btAlignedObjectArray<int> ts;
       int i;

       for(i=0;i<m_tris.size();i++)
       {
              if(m_tris[i])
              {
                     for(int j=0;j<3;j++)
                            ts.push_back((*m_tris[i])[j]);
                     deAllocateTriangle(m_tris[i]);
              }
       }
       tris_count = ts.size()/3;
       tris_out.resize(ts.size());
       
       for (i=0;i<ts.size();i++)
       {
              tris_out[i] = ts[i];
       }
       m_tris.resize(0);

       return 1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int HullLibrary::calchullgen ( btVector3 verts,
int  verts_count,
int  vlimit 
) [private]

Definition at line 509 of file btConvexHull.cpp.

{
       if(verts_count <4) return 0;
       if(vlimit==0) vlimit=1000000000;
       int j;
       btVector3 bmin(*verts),bmax(*verts);
       btAlignedObjectArray<int> isextreme;
       isextreme.reserve(verts_count);
       btAlignedObjectArray<int> allow;
       allow.reserve(verts_count);

       for(j=0;j<verts_count;j++) 
       {
              allow.push_back(1);
              isextreme.push_back(0);
              bmin.setMin (verts[j]);
              bmax.setMax (verts[j]);
       }
       btScalar epsilon = (bmax-bmin).length() * btScalar(0.001);
       btAssert (epsilon != 0.0);


       int4 p = FindSimplex(verts,verts_count,allow);
       if(p.x==-1) return 0; // simplex failed



       btVector3 center = (verts[p[0]]+verts[p[1]]+verts[p[2]]+verts[p[3]]) / btScalar(4.0);  // a valid interior point
       Tri *t0 = allocateTriangle(p[2],p[3],p[1]); t0->n=int3(2,3,1);
       Tri *t1 = allocateTriangle(p[3],p[2],p[0]); t1->n=int3(3,2,0);
       Tri *t2 = allocateTriangle(p[0],p[1],p[3]); t2->n=int3(0,1,3);
       Tri *t3 = allocateTriangle(p[1],p[0],p[2]); t3->n=int3(1,0,2);
       isextreme[p[0]]=isextreme[p[1]]=isextreme[p[2]]=isextreme[p[3]]=1;
       checkit(t0);checkit(t1);checkit(t2);checkit(t3);

       for(j=0;j<m_tris.size();j++)
       {
              Tri *t=m_tris[j];
              btAssert(t);
              btAssert(t->vmax<0);
              btVector3 n=TriNormal(verts[(*t)[0]],verts[(*t)[1]],verts[(*t)[2]]);
              t->vmax = maxdirsterid(verts,verts_count,n,allow);
              t->rise = dot(n,verts[t->vmax]-verts[(*t)[0]]);
       }
       Tri *te;
       vlimit-=4;
       while(vlimit >0 && (te=extrudable(epsilon)))
       {
              int3 ti=*te;
              int v=te->vmax;
              btAssert(v != -1);
              btAssert(!isextreme[v]);  // wtf we've already done this vertex
              isextreme[v]=1;
              //if(v==p0 || v==p1 || v==p2 || v==p3) continue; // done these already
              j=m_tris.size();
              while(j--) {
                     if(!m_tris[j]) continue;
                     int3 t=*m_tris[j];
                     if(above(verts,t,verts[v],btScalar(0.01)*epsilon)) 
                     {
                            extrude(m_tris[j],v);
                     }
              }
              // now check for those degenerate cases where we have a flipped triangle or a really skinny triangle
              j=m_tris.size();
              while(j--)
              {
                     if(!m_tris[j]) continue;
                     if(!hasvert(*m_tris[j],v)) break;
                     int3 nt=*m_tris[j];
                     if(above(verts,nt,center,btScalar(0.01)*epsilon)  || cross(verts[nt[1]]-verts[nt[0]],verts[nt[2]]-verts[nt[1]]).length()< epsilon*epsilon*btScalar(0.1) )
                     {
                            Tri *nb = m_tris[m_tris[j]->n[0]];
                            btAssert(nb);btAssert(!hasvert(*nb,v));btAssert(nb->id<j);
                            extrude(nb,v);
                            j=m_tris.size(); 
                     }
              } 
              j=m_tris.size();
              while(j--)
              {
                     Tri *t=m_tris[j];
                     if(!t) continue;
                     if(t->vmax>=0) break;
                     btVector3 n=TriNormal(verts[(*t)[0]],verts[(*t)[1]],verts[(*t)[2]]);
                     t->vmax = maxdirsterid(verts,verts_count,n,allow);
                     if(isextreme[t->vmax]) 
                     {
                            t->vmax=-1; // already done that vertex - algorithm needs to be able to terminate.
                     }
                     else
                     {
                            t->rise = dot(n,verts[t->vmax]-verts[(*t)[0]]);
                     }
              }
              vlimit --;
       }
       return 1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void HullLibrary::checkit ( Tri t) [private]

Definition at line 399 of file btConvexHull.cpp.

{
       int i;
       btAssert(m_tris[t->id]==t);
       for(i=0;i<3;i++)
       {
              int i1=(i+1)%3;
              int i2=(i+2)%3;
              int a = (*t)[i1];
              int b = (*t)[i2];
              btAssert(a!=b);
              btAssert( m_tris[t->n[i]]->neib(b,a) == t->id);
       }
}

Here is the caller graph for this function:

bool HullLibrary::CleanupVertices ( unsigned int  svcount,
const btVector3 svertices,
unsigned int  stride,
unsigned int &  vcount,
btVector3 vertices,
btScalar  normalepsilon,
btVector3 scale 
) [private]

XXX might be broken

Definition at line 845 of file btConvexHull.cpp.

{
       if ( svcount == 0 ) return false;


#define EPSILON btScalar(0.000001) /* close enough to consider two btScalaring point numbers to be 'the same'. */

       vcount = 0;

       btScalar recip[3];

       if ( scale )
       {
              scale[0] = 1;
              scale[1] = 1;
              scale[2] = 1;
       }

       btScalar bmin[3] = {  FLT_MAX,  FLT_MAX,  FLT_MAX };
       btScalar bmax[3] = { -FLT_MAX, -FLT_MAX, -FLT_MAX };

       const char *vtx = (const char *) svertices;

       if ( 1 )
       {
              for (unsigned int i=0; i<svcount; i++)
              {
                     const btScalar *p = (const btScalar *) vtx;

                     vtx+=stride;

                     for (int j=0; j<3; j++)
                     {
                            if ( p[j] < bmin[j] ) bmin[j] = p[j];
                            if ( p[j] > bmax[j] ) bmax[j] = p[j];
                     }
              }
       }

       btScalar dx = bmax[0] - bmin[0];
       btScalar dy = bmax[1] - bmin[1];
       btScalar dz = bmax[2] - bmin[2];

       btVector3 center;

       center[0] = dx*btScalar(0.5) + bmin[0];
       center[1] = dy*btScalar(0.5) + bmin[1];
       center[2] = dz*btScalar(0.5) + bmin[2];

       if ( dx < EPSILON || dy < EPSILON || dz < EPSILON || svcount < 3 )
       {

              btScalar len = FLT_MAX;

              if ( dx > EPSILON && dx < len ) len = dx;
              if ( dy > EPSILON && dy < len ) len = dy;
              if ( dz > EPSILON && dz < len ) len = dz;

              if ( len == FLT_MAX )
              {
                     dx = dy = dz = btScalar(0.01); // one centimeter
              }
              else
              {
                     if ( dx < EPSILON ) dx = len * btScalar(0.05); // 1/5th the shortest non-zero edge.
                     if ( dy < EPSILON ) dy = len * btScalar(0.05);
                     if ( dz < EPSILON ) dz = len * btScalar(0.05);
              }

              btScalar x1 = center[0] - dx;
              btScalar x2 = center[0] + dx;

              btScalar y1 = center[1] - dy;
              btScalar y2 = center[1] + dy;

              btScalar z1 = center[2] - dz;
              btScalar z2 = center[2] + dz;

              addPoint(vcount,vertices,x1,y1,z1);
              addPoint(vcount,vertices,x2,y1,z1);
              addPoint(vcount,vertices,x2,y2,z1);
              addPoint(vcount,vertices,x1,y2,z1);
              addPoint(vcount,vertices,x1,y1,z2);
              addPoint(vcount,vertices,x2,y1,z2);
              addPoint(vcount,vertices,x2,y2,z2);
              addPoint(vcount,vertices,x1,y2,z2);

              return true; // return cube


       }
       else
       {
              if ( scale )
              {
                     scale[0] = dx;
                     scale[1] = dy;
                     scale[2] = dz;

                     recip[0] = 1 / dx;
                     recip[1] = 1 / dy;
                     recip[2] = 1 / dz;

                     center[0]*=recip[0];
                     center[1]*=recip[1];
                     center[2]*=recip[2];

              }

       }



       vtx = (const char *) svertices;

       for (unsigned int i=0; i<svcount; i++)
       {
              const btVector3 *p = (const btVector3 *)vtx;
              vtx+=stride;

              btScalar px = p->getX();
              btScalar py = p->getY();
              btScalar pz = p->getZ();

              if ( scale )
              {
                     px = px*recip[0]; // normalize
                     py = py*recip[1]; // normalize
                     pz = pz*recip[2]; // normalize
              }

              if ( 1 )
              {
                     unsigned int j;

                     for (j=0; j<vcount; j++)
                     {
                            btVector3& v = vertices[j];

                            btScalar x = v[0];
                            btScalar y = v[1];
                            btScalar z = v[2];

                            btScalar dx = fabsf(x - px );
                            btScalar dy = fabsf(y - py );
                            btScalar dz = fabsf(z - pz );

                            if ( dx < normalepsilon && dy < normalepsilon && dz < normalepsilon )
                            {
                                   // ok, it is close enough to the old one
                                   // now let us see if it is further from the center of the point cloud than the one we already recorded.
                                   // in which case we keep this one instead.

                                   btScalar dist1 = GetDist(px,py,pz,center);
                                   btScalar dist2 = GetDist(v[0],v[1],v[2],center);

                                   if ( dist1 > dist2 )
                                   {
                                          v[0] = px;
                                          v[1] = py;
                                          v[2] = pz;
                                   }

                                   break;
                            }
                     }

                     if ( j == vcount )
                     {
                            btVector3& dest = vertices[vcount];
                            dest[0] = px;
                            dest[1] = py;
                            dest[2] = pz;
                            vcount++;
                     }
              }
       }

       // ok..now make sure we didn't prune so many vertices it is now invalid.
       if ( 1 )
       {
              btScalar bmin[3] = {  FLT_MAX,  FLT_MAX,  FLT_MAX };
              btScalar bmax[3] = { -FLT_MAX, -FLT_MAX, -FLT_MAX };

              for (unsigned int i=0; i<vcount; i++)
              {
                     const btVector3& p = vertices[i];
                     for (int j=0; j<3; j++)
                     {
                            if ( p[j] < bmin[j] ) bmin[j] = p[j];
                            if ( p[j] > bmax[j] ) bmax[j] = p[j];
                     }
              }

              btScalar dx = bmax[0] - bmin[0];
              btScalar dy = bmax[1] - bmin[1];
              btScalar dz = bmax[2] - bmin[2];

              if ( dx < EPSILON || dy < EPSILON || dz < EPSILON || vcount < 3)
              {
                     btScalar cx = dx*btScalar(0.5) + bmin[0];
                     btScalar cy = dy*btScalar(0.5) + bmin[1];
                     btScalar cz = dz*btScalar(0.5) + bmin[2];

                     btScalar len = FLT_MAX;

                     if ( dx >= EPSILON && dx < len ) len = dx;
                     if ( dy >= EPSILON && dy < len ) len = dy;
                     if ( dz >= EPSILON && dz < len ) len = dz;

                     if ( len == FLT_MAX )
                     {
                            dx = dy = dz = btScalar(0.01); // one centimeter
                     }
                     else
                     {
                            if ( dx < EPSILON ) dx = len * btScalar(0.05); // 1/5th the shortest non-zero edge.
                            if ( dy < EPSILON ) dy = len * btScalar(0.05);
                            if ( dz < EPSILON ) dz = len * btScalar(0.05);
                     }

                     btScalar x1 = cx - dx;
                     btScalar x2 = cx + dx;

                     btScalar y1 = cy - dy;
                     btScalar y2 = cy + dy;

                     btScalar z1 = cz - dz;
                     btScalar z2 = cz + dz;

                     vcount = 0; // add box

                     addPoint(vcount,vertices,x1,y1,z1);
                     addPoint(vcount,vertices,x2,y1,z1);
                     addPoint(vcount,vertices,x2,y2,z1);
                     addPoint(vcount,vertices,x1,y2,z1);
                     addPoint(vcount,vertices,x1,y1,z2);
                     addPoint(vcount,vertices,x2,y1,z2);
                     addPoint(vcount,vertices,x2,y2,z2);
                     addPoint(vcount,vertices,x1,y2,z2);

                     return true;
              }
       }

       return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool HullLibrary::ComputeHull ( unsigned int  vcount,
const btVector3 vertices,
PHullResult result,
unsigned int  vlimit 
) [private]

Definition at line 641 of file btConvexHull.cpp.

{
       
       int    tris_count;
       int ret = calchull( (btVector3 *) vertices, (int) vcount, result.m_Indices, tris_count, vlimit );
       if(!ret) return false;
       result.mIndexCount = (unsigned int) (tris_count*3);
       result.mFaceCount  = (unsigned int) tris_count;
       result.mVertices   = (btVector3*) vertices;
       result.mVcount     = (unsigned int) vcount;
       return true;

}

Here is the call graph for this function:

Here is the caller graph for this function:

class ConvexH* HullLibrary::ConvexHCrop ( ConvexH convex,
const btPlane slice 
) [private]
HullError HullLibrary::CreateConvexHull ( const HullDesc desc,
HullResult result 
)

Definition at line 681 of file btConvexHull.cpp.

{
       HullError ret = QE_FAIL;


       PHullResult hr;

       unsigned int vcount = desc.mVcount;
       if ( vcount < 8 ) vcount = 8;

       btAlignedObjectArray<btVector3> vertexSource;
       vertexSource.resize(vcount);

       btVector3 scale;

       unsigned int ovcount;

       bool ok = CleanupVertices(desc.mVcount,desc.mVertices, desc.mVertexStride, ovcount, &vertexSource[0], desc.mNormalEpsilon, scale ); // normalize point cloud, remove duplicates!

       if ( ok )
       {


              if ( 1 ) // scale vertices back to their original size.
              {
                     for (unsigned int i=0; i<ovcount; i++)
                     {
                            btVector3& v = vertexSource[i];
                            v[0]*=scale[0];
                            v[1]*=scale[1];
                            v[2]*=scale[2];
                     }
              }

              ok = ComputeHull(ovcount,&vertexSource[0],hr,desc.mMaxVertices);

              if ( ok )
              {

                     // re-index triangle mesh so it refers to only used vertices, rebuild a new vertex table.
                     btAlignedObjectArray<btVector3>    vertexScratch;
                     vertexScratch.resize(hr.mVcount);

                     BringOutYourDead(hr.mVertices,hr.mVcount, &vertexScratch[0], ovcount, &hr.m_Indices[0], hr.mIndexCount );

                     ret = QE_OK;

                     if ( desc.HasHullFlag(QF_TRIANGLES) ) // if he wants the results as triangle!
                     {
                            result.mPolygons          = false;
                            result.mNumOutputVertices = ovcount;
                            result.m_OutputVertices.resize(ovcount);
                            result.mNumFaces          = hr.mFaceCount;
                            result.mNumIndices        = hr.mIndexCount;

                            result.m_Indices.resize(hr.mIndexCount);

                            memcpy(&result.m_OutputVertices[0], &vertexScratch[0], sizeof(btVector3)*ovcount );

                     if ( desc.HasHullFlag(QF_REVERSE_ORDER) )
                            {

                                   const unsigned int *source = &hr.m_Indices[0];
                                   unsigned int *dest   = &result.m_Indices[0];

                                   for (unsigned int i=0; i<hr.mFaceCount; i++)
                                   {
                                          dest[0] = source[2];
                                          dest[1] = source[1];
                                          dest[2] = source[0];
                                          dest+=3;
                                          source+=3;
                                   }

                            }
                            else
                            {
                                   memcpy(&result.m_Indices[0], &hr.m_Indices[0], sizeof(unsigned int)*hr.mIndexCount);
                            }
                     }
                     else
                     {
                            result.mPolygons          = true;
                            result.mNumOutputVertices = ovcount;
                            result.m_OutputVertices.resize(ovcount);
                            result.mNumFaces          = hr.mFaceCount;
                            result.mNumIndices        = hr.mIndexCount+hr.mFaceCount;
                            result.m_Indices.resize(result.mNumIndices);
                            memcpy(&result.m_OutputVertices[0], &vertexScratch[0], sizeof(btVector3)*ovcount );

                            if ( 1 )
                            {
                                   const unsigned int *source = &hr.m_Indices[0];
                                   unsigned int *dest   = &result.m_Indices[0];
                                   for (unsigned int i=0; i<hr.mFaceCount; i++)
                                   {
                                          dest[0] = 3;
                                          if ( desc.HasHullFlag(QF_REVERSE_ORDER) )
                                          {
                                                 dest[1] = source[2];
                                                 dest[2] = source[1];
                                                 dest[3] = source[0];
                                          }
                                          else
                                          {
                                                 dest[1] = source[0];
                                                 dest[2] = source[1];
                                                 dest[3] = source[2];
                                          }

                                          dest+=4;
                                          source+=3;
                                   }
                            }
                     }
                     ReleaseHull(hr);
              }
       }

       return ret;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void HullLibrary::deAllocateTriangle ( Tri tri) [private]

Definition at line 424 of file btConvexHull.cpp.

{
       btAssert(m_tris[tri->id]==tri);
       m_tris[tri->id]=NULL;
       tri->~Tri();
       btAlignedFree(tri);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Tri * HullLibrary::extrudable ( btScalar  epsilon) [private]

Definition at line 456 of file btConvexHull.cpp.

{
       int i;
       Tri *t=NULL;
       for(i=0;i<m_tris.size();i++)
       {
              if(!t || (m_tris[i] && t->rise<m_tris[i]->rise))
              {
                     t = m_tris[i];
              }
       }
       return (t->rise >epsilon)?t:NULL ;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void HullLibrary::extrude ( class Tri t0,
int  v 
) [private]

Definition at line 433 of file btConvexHull.cpp.

{
       int3 t= *t0;
       int n = m_tris.size();
       Tri* ta = allocateTriangle(v,t[1],t[2]);
       ta->n = int3(t0->n[0],n+1,n+2);
       m_tris[t0->n[0]]->neib(t[1],t[2]) = n+0;
       Tri* tb = allocateTriangle(v,t[2],t[0]);
       tb->n = int3(t0->n[1],n+2,n+0);
       m_tris[t0->n[1]]->neib(t[2],t[0]) = n+1;
       Tri* tc = allocateTriangle(v,t[0],t[1]);
       tc->n = int3(t0->n[2],n+0,n+1);
       m_tris[t0->n[2]]->neib(t[0],t[1]) = n+2;
       checkit(ta);
       checkit(tb);
       checkit(tc);
       if(hasvert(*m_tris[ta->n[0]],v)) removeb2b(ta,m_tris[ta->n[0]]);
       if(hasvert(*m_tris[tb->n[0]],v)) removeb2b(tb,m_tris[tb->n[0]]);
       if(hasvert(*m_tris[tc->n[0]],v)) removeb2b(tc,m_tris[tc->n[0]]);
       deAllocateTriangle(t0);

}

Here is the call graph for this function:

Here is the caller graph for this function:

int4 HullLibrary::FindSimplex ( btVector3 verts,
int  verts_count,
btAlignedObjectArray< int > &  allow 
) [private]

Definition at line 473 of file btConvexHull.cpp.

{
       btVector3 basis[3];
       basis[0] = btVector3( btScalar(0.01), btScalar(0.02), btScalar(1.0) );      
       int p0 = maxdirsterid(verts,verts_count, basis[0],allow);   
       int    p1 = maxdirsterid(verts,verts_count,-basis[0],allow);
       basis[0] = verts[p0]-verts[p1];
       if(p0==p1 || basis[0]==btVector3(0,0,0)) 
              return int4(-1,-1,-1,-1);
       basis[1] = cross(btVector3(     btScalar(1),btScalar(0.02), btScalar(0)),basis[0]);
       basis[2] = cross(btVector3(btScalar(-0.02),     btScalar(1), btScalar(0)),basis[0]);
       if (basis[1].length() > basis[2].length())
       {
              basis[1].normalize();
       } else {
              basis[1] = basis[2];
              basis[1].normalize ();
       }
       int p2 = maxdirsterid(verts,verts_count,basis[1],allow);
       if(p2 == p0 || p2 == p1)
       {
              p2 = maxdirsterid(verts,verts_count,-basis[1],allow);
       }
       if(p2 == p0 || p2 == p1) 
              return int4(-1,-1,-1,-1);
       basis[1] = verts[p2] - verts[p0];
       basis[2] = cross(basis[1],basis[0]).normalized();
       int p3 = maxdirsterid(verts,verts_count,basis[2],allow);
       if(p3==p0||p3==p1||p3==p2) p3 = maxdirsterid(verts,verts_count,-basis[2],allow);
       if(p3==p0||p3==p1||p3==p2) 
              return int4(-1,-1,-1,-1);
       btAssert(!(p0==p1||p0==p2||p0==p3||p1==p2||p1==p3||p2==p3));
       if(dot(verts[p3]-verts[p0],cross(verts[p1]-verts[p0],verts[p2]-verts[p0])) <0) {Swap(p2,p3);}
       return int4(p0,p1,p2,p3);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 806 of file btConvexHull.cpp.

{
       if ( result.m_OutputVertices.size())
       {
              result.mNumOutputVertices=0;
              result.m_OutputVertices.clear();
       }
       if ( result.m_Indices.size() )
       {
              result.mNumIndices=0;
              result.m_Indices.clear();
       }
       return QE_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void HullLibrary::removeb2b ( Tri s,
Tri t 
) [private]

Definition at line 391 of file btConvexHull.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 189 of file btConvexHull.h.


The documentation for this class was generated from the following files: