Open nicetaker opened 9 months ago
look at your get_point method:
float3 &get_point(PointPlusPayload &data) { return data.position; }
it is defined as taking - as first parameter - a NON-CONST reference to a data, meaning it would allow that method to modify that point. But the builder calls that with a 'const data_t', which means that the builder cannot allow any modifications to that point... and thus, it refuses to call your function.
If you look in my example code (testing/testPointPlusPayloadFromReadme.cu) you'll see that in my sample code that same function looks like this:
float3 get_point(const PointPlusPayload &data)
In my version that method accepts a refernce to a CONST data (and returns a copy, not a reference), so the builder is happy to call it.
hello,
The reason why I use the payload in struct PointPlusPayload is everytime I use cct::buildtree It will changer the origin index of my 3Dpoints . Now I run the example code (testing/testPointPlusPayloadFromReadme.cu) succeed,but i have a question about it.
how can i use the fcp or knn in struct PointPlusPayload ? Or is there any other way to solve this problem? So I can find my source points Index after buildtree?
struct PointPlusPayload { float3 position; int payload; };
yes, that's the right way to go. you can store your original index in the payload, and then use these traits to describe this. if this works for the builder, it should also work for the fcp and knn queries. they're all templated over both data_t and data_traits_t, the same way as the builder. Does this not work?
yes, that's the right way to go. you can store your original index in the payload, and then use these traits to describe this.
if this works for the builder, it should also work for the fcp and knn queries. they're all templated over both data_t and data_traits_t, the same way as the builder. Does this not work?
it doesn't work,It always say ’don't match the math.h’ or something else .can you give me a simple example on how to use fcp or knn? Thank you!
added a fcp call to the sample code.
hello,when i follow the example like:
/ code / struct PointPlusPayload { float3 position; int payload; };
struct PointPlusPayload_traits : public cukd::default_data_traits
{
using point_t = float3;
static inline device host
float3 &get_point(PointPlusPayload &data) { return data.position; }
static inline device host float get_coord(const PointPlusPayload &data, int dim) { return cukd::get_coord(get_point(data),dim); } };
void test_kdtree() {
PointPlusPayload *data; cudaMallocManaged((char *)&data,countsizeof(*data));
/... fill the data/
cukd::buildTree </ type of the data: /PointPlusPayload , / traits for this data: /PointPlusPayload_traits> (data,count); std::cout<<"build tree done"<<std::endl;
} / code /
I got 3 errors:
.cu: error: qualifiers dropped in binding reference of type "PointPlusPayload &" to initializer of type "const PointPlusPayload"
builder_common.h(84): error: qualifiers dropped in binding reference of type "PointPlusPayload &" to initializer of type "const PointPlusPayload" detected during: instantiation of "void cukd::computeBounds_copyFirst<data_t,data_traits>(cukd::box_t , const data_t ) [with data_t=PointPlusPayload, data_traits=PointPlusPayload_traits]"
builder_common.h(137): error: qualifiers dropped in binding reference of type "PointPlusPayload &" to initializer of type "const PointPlusPayload" detected during: instantiation of "void cukd::computeBounds_atomicGrow<data_t,data_traits>(cukd::box_t , const data_t , int) [with data_t=PointPlusPayload, data_traits=PointPlusPayload_traits]"
plz tell me how can i fix that? thanx!