kdtree source problem

Paul Harris paulharris at computer.org
Sun Nov 16 03:18:37 UTC 2008


sorry don't have much time to go into it fully, but you are trying to use

t.count_within_range(p,range)
which is defined as:
size_type
        count_within_range(const_reference __V, subvalue_type const __R)
const

instead, use
 size_type
        count_within_range(_Region_ const& __REGION) const

which basically means you make your own Region and then call the count
method.

eg (I've forgotten how to do this with less fuss, but maybe someone else
knows)

tree_type::Region region( p, 0, tree.value_acc(), tree.value_comp() );
// 0: initial range is zero

// set up the box
region.set_low_bound( 54, 0 );
region.set_high_bound( 56, 0 );
// repeat for each dimension.  in the above, '0' is the first dimension.

// do the count
num = tree.count_within_range(region);

so this will look within the box defined by region...

hows that?


2008/11/16 Alex Hong <hhong at cs.kent.edu>

> Hello, guys
>  I'm working on your kdtree-source, and I want to modify your test to
> accept different range restrictives on each dimensional, as this:
> ***************************************
> in test_kdtree.hpp
> ***************************************
>  Line 76:
> //  unsigned int const RANGE =3;
>  std::vector<int> RANGE;
>  RANGE.push_back(3);
>  RANGE.push_back(3);
>  RANGE.push_back(3);
>
> Line 78:  size_t count = t.count_within_range(s, RANGE);
> ***************************************
>
>  In order to achieve that, I modify your variable R in the file
> "region.hpp" to R[__i], for example:
> ***************************************
> in region.hpp
> ***************************************
> Line 23: typedef std::vector<_SubVal> subvalue_type1;
> Line 41: subvalue_type1 const& __R
> Line 45: _M_low_bounds[__i] = _M_acc(__V,__i) - __R[__i];
> Line 46: _M_high_bounds[__i] = _M_acc(__V,__i) + __R[__i];
> ***************************************
>  But it doesn't work.
>  Could you guys with gift help me out?
>  Thank you  very much.
>
> --
>
> Regards,
> Hui Hong(Alex)
> 875B Allerton Street, Kent, OH, 44240
> Cell: 562-373-8939
> Work: 330-672-9107
> Home: 330-238-4168
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.alioth.debian.org/pipermail/libkdtree-devel/attachments/20081116/a6fe63e8/attachment.htm 


More information about the libkdtree-devel mailing list