Merge overlapping points
769219
function dedupPoints (floatPoints, ratPoints, floatBounds) {
  var numPoints = ratPoints.length
  var uf = new UnionFind(numPoints)

  // Compute rational bounds
  var bounds = []
  for (var i = 0; i < ratPoints.length; ++i) {
    var p = ratPoints[i]
    var xb = boundRat(p[0])
    var yb = boundRat(p[1])
    bounds.push([
      nextafter(xb[0], -Infinity),
      nextafter(yb[0], -Infinity),
      nextafter(xb[1], Infinity),
      nextafter(yb[1], Infinity)
    ])
  }

  // Link all points with over lapping boxes
  boxIntersect(bounds, function (i, j) {
    uf.link(i, j)
  })

  // Do 1 pass over points to combine points in label sets
  var noDupes = true
  var labels = new Array(numPoints)
  for (var i = 0; i < numPoints; ++i) {
    var j = uf.find(i)
    if (j !== i) {
      // Clear no-dupes flag, zero out label
      noDupes = false
      // Make each point the top-left point from its cell
      floatPoints[j] = [
        Math.min(floatPoints[i][0], floatPoints[j][0]),
        Math.min(floatPoints[i][1], floatPoints[j][1])
      ]
    }
  }

  // If no duplicates, return null to signal termination
  if (noDupes) {
    return null
  }

  var ptr = 0
  for (var i = 0; i < numPoints; ++i) {
    var j = uf.find(i)
    if (j === i) {
      labels[i] = ptr
      floatPoints[ptr++] = floatPoints[i]
    } else {
      labels[i] = -1
    }
  }

  floatPoints.length = ptr

  // Do a second pass to fix up missing labels
  for (var i = 0; i < numPoints; ++i) {
    if (labels[i] < 0) {
      labels[i] = labels[uf.find(i)]
    }
  }

  // Return resulting union-find data structure
  return labels
}
491662
function removeOverlapPoints(points) {
            var hash = {};
            var ret = [];
            for (var i = 0, l = points.length; i < l; i++) {
                var hashcode = points[i].x * 31 + points[i].y;
                if (!hash[hashcode]) {
                    ret.push(points[i]);
                    hash[hashcode] = 1;
                }
            }
            return ret;
        }
548202
def point2upoint(point):
    """"""
    upoint = [set(), set()]
    for v, val in point.items():
        upoint[val].add(v.uniqid)
    upoint[0] = frozenset(upoint[0])
    upoint[1] = frozenset(upoint[1])
    return tuple(upoint)
571851
def intersection(self, other, ignore_conflicts=False):
        """"""
        result = self.copy()
        result.intersection_update(other, ignore_conflicts)
        return result
468967
def merge_and_fit(self, track, pairings):
        

        for (self_seg_index, track_seg_index, _) in pairings:
            self_s = self.segments[self_seg_index]
            ss_start = self_s.points[0]
            track_s = track.segments[track_seg_index]
            tt_start = track_s.points[0]
            tt_end = track_s.points[-1]

            d_start = ss_start.distance(tt_start)
            d_end = ss_start.distance(tt_end)

            if d_start > d_end:
                track_s = track_s.copy()
                track_s.points = list(reversed(track_s.points))

            self_s.merge_and_fit(track_s)
        return self
1242830
def points_close(a,b):
    '''
    
    '''
    (a,b) = [np.asarray(u) for u in (a,b)]
    if len(a.shape) == 2 or len(b.shape) == 2: (a,b) = [np.reshape(u,(len(u),-1)) for u in (a,b)]
    return np.isclose(np.sqrt(np.sum((a - b)**2, axis=0)), 0)
1322252
private Point2D intersect(List<Point2D> outline, Line2D line) {

        Point2D previousPoint = outline.get(outline.size() - 1);
        for (Point2D point : outline) {

            Line2D currentLine = new Line2D.Double(point.getX(), point.getY(), previousPoint.getX(),
                    previousPoint.getY());
            if (line.intersectsLine(currentLine)) {
                return lineLineIntersect(currentLine, line);
            }
            previousPoint = point;
        }
        return new Point2D.Double(line.getX1(), line.getY1());
    }
390153
def merge(data,skip=50,fraction=1.0):
    """"""

    w,s,d = data.chains.shape
    
    start = int((1.0 - fraction) * s)
    total = int((s - start) / skip)
        
    return data.chains[:,start::skip,:].reshape((w*total,d))
144378
protected void mergeSmallRegions() {
		for( int i = 0; i < edgesNotMatched.size(); i++ ) {
			Edge e = edgesNotMatched.get(i);

			int rootA = find(e.indexA);
			int rootB = find(e.indexB);

			// see if they are already part of the same segment
			if( rootA == rootB )
				continue;

			int sizeA = regionSize.get(rootA);
			int sizeB = regionSize.get(rootB);

			// merge if one of the regions is too small
			if( sizeA < minimumSize || sizeB < minimumSize ) {
				// Point everything towards rootA
				graph.data[e.indexB] = rootA;
				graph.data[rootB] = rootA;

				// Update the size of regionA
				regionSize.data[rootA] = sizeA + sizeB;
			}
		}
	}
454437
def overlap(self, x, ctrs, kdtree=None):
        """"""

        q = len(self.within(x, ctrs, kdtree=kdtree))

        return q
462666
def blend_value(data, i, j, k, keys=None):
    """"""

    key_size = len(list(data.keys())[0])
    if not keys:
        keys = triangle_coordinates(i, j, k)
    # Reduce key from (i, j, k) to (i, j) if necessary
    keys = [tuple(key[:key_size]) for key in keys]

    # Sum over the values of the points to blend
    try:
        s = sum(data[key] for key in keys)
        value = s / 3.
    except KeyError:
        value = None
    return value
1203617
def merge(cls, tables, fillna=False):
        """"""
        cols = set(itertools.chain(*[table.dtype.descr for table in tables]))

        tables_to_merge = []
        for table in tables:
            missing_cols = cols - set(table.dtype.descr)

            if missing_cols:
                if fillna:
                    n = len(table)
                    n_cols = len(missing_cols)
                    col_names = []
                    for col_name, col_dtype in missing_cols:
                        if 'f' not in col_dtype:
                            raise ValueError(
                                "Cannot create NaNs for non-float"
                                " type column '{}'".format(col_name)
                            )
                        col_names.append(col_name)

                    table = table.append_columns(
                        col_names, np.full((n_cols, n), np.nan)
                    )
                else:
                    raise ValueError(
                        "Table columns do not match. Use fill_na=True"
                        " if you want to append missing values with NaNs"
                    )
            tables_to_merge.append(table)

        first_table = tables_to_merge[0]

        merged_table = sum(tables_to_merge[1:], first_table)

        merged_table.h5loc = first_table.h5loc
        merged_table.h5singleton = first_table.h5singleton
        merged_table.split_h5 = first_table.split_h5
        merged_table.name = first_table.name

        return merged_table
557420
def _merge_maps(m1, m2):
    """"""
    return type(m1)(chain(m1.items(), m2.items()))
145612
def overlap(self, other):
        """"""
        if self._start < other.end and self._end > other.start:
            return True
        return False
972555
def _merge_two_dicts(x, y):
    
    z = x.copy()
    z.update(y)
    return z
603989
function addPoints (x1, y1, x2, y2, cb) {
	var xFinal = x1 + x2;
	var yFinal = y1 + y2;
	cb(xFinal, yFinal);
}
971618
def combine_xml_points(l, units, handle_units):
    """"""
    ret = {}
    for item in l:
        for key, value in item.items():
            ret.setdefault(key, []).append(value)

    for key, value in ret.items():
        if key != 'date':
            ret[key] = handle_units(value, units.get(key, None))

    return ret