removed STL usage of Extras/ConvexBuilder and replaced by btAlignedObjectArray

fixed several warnings, thanks to sparkprime
added comments patch for linear math, thanks to Tully Foote
This commit is contained in:
erwin.coumans
2008-10-28 18:52:46 +00:00
parent c5112e68e5
commit 28e580c203
39 changed files with 435 additions and 196 deletions

View File

@@ -5,7 +5,6 @@
#include <assert.h>
#include "cd_hull.h"
#include <algorithm>
#include "fitsphere.h"
#include "bestfitobb.h"
@@ -59,10 +58,10 @@ ConvexBuilder::ConvexBuilder(ConvexDecompInterface *callback)
ConvexBuilder::~ConvexBuilder(void)
{
CHullVector::iterator i;
for (i=mChulls.begin(); i!=mChulls.end(); ++i)
int i;
for (i=0;i<mChulls.size();i++)
{
CHull *cr = (*i);
CHull *cr = mChulls[i];
delete cr;
}
}
@@ -197,16 +196,16 @@ bool ConvexBuilder::combineHulls(void)
CHullVector output; // the output hulls...
CHullVector::iterator i;
int i;
for (i=mChulls.begin(); i!=mChulls.end() && !combine; ++i)
for (i=0;i<mChulls.size() && !combine; ++i)
{
CHull *cr = (*i);
CHull *cr = mChulls[i];
CHullVector::iterator j;
for (j=mChulls.begin(); j!=mChulls.end(); ++j)
int j;
for (j=0;j<mChulls.size();j++)
{
CHull *match = (*j);
CHull *match = mChulls[j];
if ( cr != match ) // don't try to merge a hull with itself, that be stoopid
{
@@ -220,9 +219,9 @@ bool ConvexBuilder::combineHulls(void)
++i;
while ( i != mChulls.end() )
while ( i != mChulls.size() )
{
CHull *cr = (*i);
CHull *cr = mChulls[i];
if ( cr != match )
{
output.push_back(cr);
@@ -275,10 +274,10 @@ unsigned int ConvexBuilder::process(const DecompDesc &desc)
while ( combineHulls() ); // keep combinging hulls until I can't combine any more...
CHullVector::iterator i;
for (i=mChulls.begin(); i!=mChulls.end(); ++i)
int i;
for (i=0;i<mChulls.size();i++)
{
CHull *cr = (*i);
CHull *cr = mChulls[i];
// before we hand it back to the application, we need to regenerate the hull based on the
// limits given by the user.
@@ -367,7 +366,8 @@ void ConvexBuilder::ConvexDecompResult(ConvexResult &result)
void ConvexBuilder::sortChulls(CHullVector &hulls)
{
std::sort( hulls.begin(), hulls.end(), CHullSort() );
hulls.quickSort(CHullSort());
//hulls.heapSort(CHullSort());
}

View File

@@ -38,6 +38,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "ConvexDecomposition.h"
#include "vlookup.h"
#include "LinearMath/btAlignedObjectArray.h"
using namespace ConvexDecomposition;
@@ -70,7 +71,7 @@ public:
};
typedef std::vector< CHull * > CHullVector;
typedef btAlignedObjectArray< CHull * > CHullVector;

View File

@@ -5,8 +5,6 @@
#include <string.h>
#include <assert.h>
#include <algorithm>
#include <vector>
/*----------------------------------------------------------------------
Copyright (c) 2004 Open Dynamics Framework Group

View File

@@ -42,6 +42,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endif
#include <string.h>
#include <stdio.h>
#include "LinearMath/btAlignedObjectArray.h"
@@ -49,8 +50,8 @@ extern unsigned int MAXDEPTH ;
extern float CONCAVE_PERCENT ;
extern float MERGE_PERCENT ;
#include <vector>
typedef std::vector< unsigned int > UintVector;
typedef btAlignedObjectArray< unsigned int > UintVector;

View File

@@ -266,7 +266,7 @@ public:
bool m_bIsRotation;
};
};
}
using namespace BestFit;

View File

@@ -147,7 +147,7 @@ private:
float *scale);
};
};
}
#endif

View File

@@ -60,7 +60,7 @@ static inline void Set(float *n,float x,float y,float z)
n[0] = x;
n[1] = y;
n[2] = z;
};
}
static inline void Copy(float *dest,const float *source)
{

View File

@@ -42,7 +42,7 @@ enum PlaneTriResult
{
PTR_FRONT,
PTR_BACK,
PTR_SPLIT,
PTR_SPLIT
};
PlaneTriResult planeTriIntersection(const float *plane, // the plane equation in Ax+By+Cz+D format

View File

@@ -54,6 +54,6 @@ bool computeSplitPlane(unsigned int vcount,
float *plane);
};
}
#endif

View File

@@ -265,12 +265,12 @@ bool VertexLess::operator()(int v1,int v2) const
return false;
};
}
};
}
using namespace Vlookup;