/// <summary> /// Uses Lev's fast proximity query to find pairs of nodes/clusters with overlapping bounding boxes. /// When such are found, they are projected apart. /// </summary> public double Project() { double displacement = 0; if (hulls.Count < AllPairsComputationLimit) { // if there are only a few nodes then do it the most straightforward n^2 way for (int i = 0; i < hulls.Count - 1; ++i) { IHull u = hulls[i]; for (int j = i + 1; j < hulls.Count; ++j) { displacement += u.Project(hulls[j]); } } } else { var pq = new ProximityQuery(hulls); List <Tuple <IHull, IHull> > closePairs = pq.GetAllIntersections(); //shuffle(ref closePairs); foreach (var k in closePairs) { displacement += k.Item1.Project(k.Item2); } } return(displacement); }
/// <summary> /// Uses Lev's fast proximity query to find pairs of nodes/clusters with overlapping bounding boxes. /// When such are found, they are projected apart. /// </summary> public double Project() { double displacement = 0; if (hulls.Count < AllPairsComputationLimit) { // if there are only a few nodes then do it the most straightforward n^2 way for (int i = 0; i < hulls.Count - 1; ++i) { IHull u = hulls[i]; for (int j = i + 1; j < hulls.Count; ++j) { displacement += u.Project(hulls[j]); } } } else { var pq = new ProximityQuery(hulls); List<Tuple<IHull, IHull>> closePairs = pq.GetAllIntersections(); //shuffle(ref closePairs); foreach (var k in closePairs) { displacement += k.Item1.Project(k.Item2); } } return displacement; }