This DCH code is based on the paper Deformable Spanners and Applications By J. Gao, L.J. Guibas, and A. Nguyen Symposium on Computational Geometry SoCG'04, pp 179--199, 2004 and partially on Distributed Proximity Maintenance in Ad Hoc Mobile Networks By J. Gao, L.J. Guibas, and A. Nguyen Distributed Computing in Sensor System DCOSS'05, 2005 The code currently implements proximity query, finding all pairs of points that are within a certain threshold distance. There must be some bound on the motion of the points (say velocity or acceleration restriction) so that the motion of the points is not too arbitrary. Suppose you store your point in a class called "MovingPoint". You need to implement the following 3 functions (see the sample class BVParticle). float MovingPoint::dist2(const MovingPoint& other) float MovingPoint::firstTimeFurther(float now, const MovingPoint& other, float threshold2) float MovingPoint::firstTimeNearer(float now, const MovingPoint& other, float threshold2) You can then create the following discrete center hierarchy type as follows: typedef DiscreteHierarchy DCH; A typical use of the data structure is: 1. Create an instance of the structure DCH dch(beta, c, minradius); beta is the expansion ratio of the hierarchy. beta = 2.0 in the paper, though it can take any value > 1.0. c must satisfy c > max(beta, 2*beta/(beta-1)). The minradius depends on the maximum motion allowed between two successive time steps at must be larger than (4*maxmovement)/(c*beta-c-2*beta). Notice that the minimum pairwise distance between the points may be smaller than minradius. As the result, the bottom level is not fully maintained. Nodes in level 1 and up in the hierarchy are maintained normally, and for nodes in the bottom level, only their parents are maintained. Edges in the bottom level, which contains all pairs of nodes within c*minradius are not maintained and can be easily extracted from the structure, see function numBottomEdges(); The parameter beta, c, and minradius should be chosen so that the edges at the bottom give the pairs of points of interest. That means if we want to find out pairs of points within a certain threshold r, minradius should be at least r/c. 2. Insert/delete points to the hierarchy MovingPoint *mp = new MovingPoint(...); ... dch.insert(mp); ... dch.remove(mp); 3. Move the points and from time to time call dch.update() Between calls to dch.update(), the points must not move more than a certain threshhold distance dictated by the minradius used during the creation of the dch. An Nguyen anguyen@graphics.stanford.edu yanguyen@gmail.com