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:

http://stackoverflow.com/questions/9505862/shortest-distance-between-two-degree-marks-on-a-circle

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.

Cheers!
Andrew Hundt