Maybe you can give me some help using it.
Currently i have this:
- Code: Select all
#ifdef USE_NEWTON_CONVEX_HULL
#include <../core/dgConvexHull3d.h>
#include <vector>
struct ConvexHull
{
std::vector<dgFloat64> tempPointData;
dgMemoryAllocator allocation;
dgFloat64 volume;
dgFloat64 surcafeArea;
//dgConvexHull3d myhull; // no defasult constructor :(
ConvexHull ()
{
volume = 0;
surcafeArea = 0;
}
~ConvexHull ()
{
}
void AddVertex (float x, float y, float z)
{
tempPointData.push_back (dgFloat64(x));
tempPointData.push_back (dgFloat64(y));
tempPointData.push_back (dgFloat64(z));
}
bool BuildConvexHull ()
{
dgConvexHull3d myhull (&allocation, &tempPointData[0], sizeof(double)*3, tempPointData.size()/3, 0.0001, 200);
myhull.CalculateVolumeAndSurfaceArea (volume, surcafeArea);
return true;
}
float Volume ()
{
return fabs(volume);
}
float Area ()
{
return fabs(surcafeArea);
}
bool TraceRay (float &tMin, float &tMax, const float* rayO, const float *rayD) const
{
// todo: keep myhull, so i can ray trace rays
//dgConvexHull3d::RayCast (const dgBigVector& localP0, const dgBigVector& localP1) const
}
};
Being OOP noob, i don't know how to keep dgConvexHull3d around so i can use it for ray tracing later.
I'd like to declare the object as a member of my ConvexHull struct, but at this point i know nothing and can't provide data about the points.
Probably i could create dgConvexHull3d with new, store a pointer to it and use this for tracing, but i'm interested if there is another solution.