On 14/07/2016 at 12:06, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 17
Platform: Windows ; Mac OSX ;
Language(s) : C++ ;
---------
Hi,
I'm looking for a way to implement a variable sorting crtiteria in my BaseSort class, but I'm not getting it to work. I just want to sort an array with vectors using a tolerance value (eps) :
class SortVector : public maxon::BaseSort <SortVector>
{
public:
static Bool LessThan(Vector a, Vector b)
{
if (a.z < b.z - eps) return true;
if (a.z > b.z + eps) return false;
return (a.x < b.x);
}
SortVector(Float d)
{
eps = d;
}
public:
static Float eps;
};
//---------------------------------
maxon::BaseArray<Vector> points;
//... filling the array ...
SortVector sort(10);
sort.Sort(points);
I want to start the sorting using the tolerance value, but the compiler gives me an unsolved symbol "eps" error because of the static declaration. But I can't omit static, because LessThan wouldn't know "eps". And finally I can't omit static for LessThan().
It happens frequently, that I need additional variable parameters for sorting. How is the provided way to do this?
Thanks of any help.