Is it possible to keep the index of input points in the output points for cySampleElimination?
marlinilram opened this issue · 2 comments
marlinilram commented
Hi, thanks for the poisson disk sampling method, is it possible to keep the index of input points in the output points for cySampleElimination?
cemyuksel commented
It should be possible by using a custom class for PointType that also stores the point index, but I haven't tested this.
alecjacobson commented
Here's what I used (might be a better way):
namespace cy
{
struct Point3f_id : public cy::Point3f
{
int i;
Point3f_id( float v): cy::Point3f(v),i(-1){}
Point3f_id(){}
Point3f_id(const Point3f_id & that): cy::Point3f(that), i(that.i) {}
Point3f_id(const Point3f & that): cy::Point3f(that), i(-1) {}
Point3f_id operator-(Point3f_id const &that) const
{
return cy::Point3f::operator-(that);
};
};
}
(sampler only seems to need the operator-
and these constructors because the bounds are stored as the given type)