I need to store a 6d set of double points on a torus and query the nearest neighbors. I believe the distance algorithm isn't too hard to implement by simply using the angle difference on each axis:


However, I'm not sure if r-tree could handle that or how to set it up. Could you provide advice? Would I need to implement an entirely new distance strategy?

I believe the basics should work with boost geometry model points because I should only be storing, querying, and taking the distance between points which if I recall correctly are among the basics implemented for higher dimensions. 

Thanks for your help.

Andrew Hundt