Returns true if multipoint_a intersects multipoint_b.
346405
private static boolean multiPointIntersectsMultiPoint_(
			MultiPoint _multipointA, MultiPoint _multipointB, double tolerance,
			ProgressTracker progress_tracker) {
		MultiPoint multipoint_a;
		MultiPoint multipoint_b;

		if (_multipointA.getPointCount() > _multipointB.getPointCount()) {
			multipoint_a = _multipointB;
			multipoint_b = _multipointA;
		} else {
			multipoint_a = _multipointA;
			multipoint_b = _multipointB;
		}

		Envelope2D env_a = new Envelope2D();
		Envelope2D env_b = new Envelope2D();
		Envelope2D envInter = new Envelope2D();
		multipoint_a.queryEnvelope2D(env_a);
		multipoint_b.queryEnvelope2D(env_b);
		env_a.inflate(tolerance, tolerance);
		env_b.inflate(tolerance, tolerance);
		envInter.setCoords(env_a);
		envInter.intersect(env_b);

		Point2D ptA = new Point2D();
		Point2D ptB = new Point2D();
		double tolerance_sq = tolerance * tolerance;

		QuadTreeImpl quadTreeB = InternalUtils.buildQuadTree(
				(MultiPointImpl) (multipoint_b._getImpl()), envInter);
		QuadTreeImpl.QuadTreeIteratorImpl qtIterB = quadTreeB.getIterator();

		for (int vertex_a = 0; vertex_a < multipoint_a.getPointCount(); vertex_a++) {
			multipoint_a.getXY(vertex_a, ptA);

			if (!envInter.contains(ptA))
				continue;

			env_a.setCoords(ptA.x, ptA.y, ptA.x, ptA.y);
			qtIterB.resetIterator(env_a, tolerance);

			for (int elementHandleB = qtIterB.next(); elementHandleB != -1; elementHandleB = qtIterB
					.next()) {
				int vertex_b = quadTreeB.getElement(elementHandleB);
				multipoint_b.getXY(vertex_b, ptB);

				if (Point2D.sqrDistance(ptA, ptB) <= tolerance_sq)
					return true;
			}
		}

		return false;
	}
1193600
public boolean intersect(double tolerance, boolean b_intersecting) {
		if (m_input_segments.size() != 2)
			throw GeometryException.GeometryInternalError();

		m_tolerance = tolerance;
		double small_tolerance_sqr = MathUtils.sqr(tolerance * 0.01);
		boolean bigmove = false;
		
		IntersectionPart part1 = m_input_segments.get(0);
		IntersectionPart part2 = m_input_segments.get(1);
		if (b_intersecting
				|| (part1.seg._isIntersecting(part2.seg, tolerance, true) & 5) != 0) {
			if (part1.seg.getType().value() == Geometry.GeometryType.Line) {
				Line line_1 = (Line) part1.seg;
				if (part2.seg.getType().value() == Geometry.GeometryType.Line) {
					Line line_2 = (Line) part2.seg;
					int count = Line._intersectLineLine(line_1, line_2, null,
							m_param_1, m_param_2, tolerance);
					if (count == 0) {
						assert (count > 0);
						throw GeometryException.GeometryInternalError();
					}
					Point2D[] points = new Point2D[9];
					for (int i = 0; i < count; i++) {
						// For each point of intersection, we calculate a
						// weighted point
						// based on the ranks and weights of the endpoints and
						// the interior.
						double t1 = m_param_1[i];
						double t2 = m_param_2[i];
						int rank1 = part1.rank_interior;
						double weight1 = 1.0;

						if (t1 == 0) {
							rank1 = part1.rank_start;
							weight1 = part1.weight_start;
						} else if (t1 == 1.0) {
							rank1 = part1.rank_end;
							weight1 = part1.weight_end;
						}

						int rank2 = part2.rank_interior;
						double weight2 = 1.0;
						if (t2 == 0) {
							rank2 = part2.rank_start;
							weight2 = part2.weight_start;
						} else if (t2 == 1.0) {
							rank2 = part2.rank_end;
							weight2 = part2.weight_end;
						}

						double ptWeight;

						Point2D pt = new Point2D();
						if (rank1 == rank2) {// for equal ranks use weighted sum
							Point2D pt_1 = new Point2D();
							line_1.getCoord2D(t1, pt_1);
							Point2D pt_2 = new Point2D();
							line_2.getCoord2D(t2, pt_2);
							ptWeight = weight1 + weight2;
							double t = weight2 / ptWeight;
							MathUtils.lerp(pt_1, pt_2, t, pt);
							if (Point2D.sqrDistance(pt, pt_1)
									+ Point2D.sqrDistance(pt, pt_2) > small_tolerance_sqr)
								bigmove = true;
							
						} else {// for non-equal ranks, the higher rank wins
							if (rank1 > rank2) {
								line_1.getCoord2D(t1, pt);
								ptWeight = weight1;
								Point2D pt_2 = new Point2D();
								line_2.getCoord2D(t2, pt_2);
								if (Point2D.sqrDistance(pt, pt_2) > small_tolerance_sqr)
									bigmove = true;
							} else {
								line_2.getCoord2D(t2, pt);
								ptWeight = weight2;
								Point2D pt_1 = new Point2D();
								line_1.getCoord2D(t1, pt_1);
								if (Point2D.sqrDistance(pt, pt_1) > small_tolerance_sqr)
									bigmove = true;
							}
						}
						points[i] = pt;
					}

					// Split the line_1, making sure the endpoints are adusted
					// to the weighted
					double t0 = 0;
					int i0 = -1;
					for (int i = 0; i <= count; i++) {
						double t = i < count ? m_param_1[i] : 1.0;
						if (t != t0) {
							SegmentBuffer seg_buffer = newSegmentBuffer_();
							line_1.cut(t0, t, seg_buffer);
							if (i0 != -1)
								seg_buffer.get().setStartXY(points[i0]);
							if (i != count)
								seg_buffer.get().setEndXY(points[i]);

							t0 = t;
							m_result_segments_1
									.add(newIntersectionPart_(seg_buffer.get()));
						}
						i0 = i;
					}

					int[] indices = new int[9];
					for (int i = 0; i < count; i++)
						indices[i] = i;

					if (count > 1) {
						if (m_param_2[0] > m_param_2[1]) {
							double t = m_param_2[0];
							m_param_2[0] = m_param_2[1];
							m_param_2[1] = t;
							int i = indices[0];
							indices[0] = indices[1];
							indices[1] = i;
						}
					}

					// Split the line_2
					t0 = 0;
					i0 = -1;
					for (int i = 0; i <= count; i++) {
						double t = i < count ? m_param_2[i] : 1.0;
						if (t != t0) {
							SegmentBuffer seg_buffer = newSegmentBuffer_();
							line_2.cut(t0, t, seg_buffer);
							if (i0 != -1) {
								int ind = indices[i0];
								seg_buffer.get().setStartXY(points[ind]);
							}
							if (i != count) {
								int ind = indices[i];
								seg_buffer.get().setEndXY(points[ind]);
							}

							t0 = t;
							m_result_segments_2
									.add(newIntersectionPart_(seg_buffer.get()));
						}
						i0 = i;
					}

					return bigmove;
				}

				throw GeometryException.GeometryInternalError();
			}

			throw GeometryException.GeometryInternalError();
		}
		
		return false;
	}
191199
def intersects(self, other):
        ''''''
        return self.CHROM == other.CHROM and self.POS <= other.ref_end_pos() and other.POS <= self.ref_end_pos()
985379
private static boolean multiPointOverlapsMultiPoint_(
			MultiPoint multipoint_a, MultiPoint multipoint_b, double tolerance,
			ProgressTracker progress_tracker) {
		return multiPointCoverageMultiPoint_(multipoint_a, multipoint_b,
				tolerance, false, false, true, progress_tracker);
	}
1175763
public boolean intersects(Geometry geometry) {
		if (geometry == null || isEmpty() || geometry.isEmpty()) {
			return false;
		}

		if (geometry.getNumGeometries() > 1) {
			for (int n = 0; n < geometry.getNumGeometries(); n++) {
				if (intersects(geometry.getGeometryN(n))) {
					return true;
				}
			}
		} else {
			final Coordinate[] coords = geometry.getCoordinates();
			if (coords.length > 1 && coordinates.length > 1) {
				for (int i = 0; i < coordinates.length - 1; i++) {
					for (int j = 0; j < coords.length - 1; j++) {
						if (Mathlib.lineIntersects(coordinates[i], coordinates[i + 1], coords[j], coords[j + 1])) {
							return true;
						}
					}
					if (Mathlib.touches(geometry, coordinates[i])) {
						return true;
					}
				}
			} else {
				// TODO implement me
			}
		}

		return false;
	}
659101
private static boolean checkVerticesForIntersection_(
			MultiVertexGeometryImpl geom, RasterizedGeometry2D rgeom) {
		// Do a quick raster test for each point. If any point is inside, then
		// there is an intersection.
		int pointCount = geom.getPointCount();
		Point2D pt = new Point2D();
		for (int ipoint = 0; ipoint < pointCount; ipoint++) {
			geom.getXY(ipoint, pt);
			RasterizedGeometry2D.HitType hit = rgeom.queryPointInGeometry(pt.x,
					pt.y);
			if (hit == RasterizedGeometry2D.HitType.Inside) {
				return true;
			}
		}

		return false;
	}
693067
static boolean intersect(int[] verts, int a, int b, int c, int d) {
        if (intersectProp(verts, a, b, c, d))
            return true;
        else if (between(verts, a, b, c) || between(verts, a, b, d) || between(verts, c, d, a)
                || between(verts, c, d, b))
            return true;
        else
            return false;
    }
87084
public boolean intersects(Geometry geometry) {
		if (geometry == null || isEmpty() || geometry.isEmpty()) {
			return false;
		}

		if (geometry.getNumGeometries() > 1) {
			for (int n = 0; n < geometry.getNumGeometries(); n++) {
				if (intersects(geometry.getGeometryN(n))) {
					return true;
				}
			}
		} else {
			Coordinate[] coordinates = geometry.getCoordinates();
			if (coordinates.length == 1) {
				return coordinate.equals(coordinates[0]);
			} else {
				for (int i = 0; i < coordinates.length - 1; i++) {
					if (Mathlib.distance(coordinates[i], coordinates[i + 1], coordinate) < Mathlib.ZERO) {
						return true;
					}
				}
			}
		}

		return false;
	}
778991
boolean hasPointFeatures()
    {
      for (int geometry = getFirstGeometry(); geometry != -1; geometry = getNextGeometry(geometry))
      {
        if (!Geometry.isMultiPath(getGeometryType(geometry)))
          return true;
      }
      return false;
    }
1336918
public static boolean isPointOnMultiPolygon(LatLng point, MultiPolygonOptions multiPolygon, boolean geodesic, double tolerance) {
        boolean near = false;
        for (PolygonOptions polygon : multiPolygon.getPolygonOptions()) {
            near = isPointOnPolygon(point, polygon, geodesic, tolerance);
            if (near) {
                break;
            }
        }
        return near;
    }
1243078
public boolean intersects(Bbox other) {
		if (other.getX() > this.getEndPoint().getX()) {
			return false;
		}
		if (other.getY() > this.getEndPoint().getY()) {
			return false;
		}
		if (other.getEndPoint().getX() < this.getX()) {
			return false;
		}
		if (other.getEndPoint().getY() < this.getY()) {
			return false;
		}
		return true;
	}
1249620
private static boolean polygonDisjointMultiPoint_(Polygon polygon_a,
			MultiPoint multipoint_b, double tolerance,
			boolean bIncludeBoundaryA, ProgressTracker progress_tracker) {
		// Quick rasterize test to see whether the the geometries are disjoint,
		// or if one is contained in the other.
		int relation = tryRasterizedContainsOrDisjoint_(polygon_a,
				multipoint_b, tolerance, false);

		if (relation == Relation.disjoint)
			return true;

		if (relation == Relation.contains)
			return false;

		Envelope2D env_a_inflated = new Envelope2D();
		polygon_a.queryEnvelope2D(env_a_inflated);
		env_a_inflated.inflate(tolerance, tolerance);
		Point2D ptB = new Point2D();

		for (int i = 0; i < multipoint_b.getPointCount(); i++) {
			multipoint_b.getXY(i, ptB);

			if (!env_a_inflated.contains(ptB))
				continue;

			PolygonUtils.PiPResult result = PolygonUtils.isPointInPolygon2D(
					polygon_a, ptB, tolerance);

			if (result == PolygonUtils.PiPResult.PiPInside
					|| (bIncludeBoundaryA && result == PolygonUtils.PiPResult.PiPBoundary))
				return false;
		}

		return true;
	}
168663
def has_intersection(self, other):
        
        return bool(lib.SDL_HasIntersection(self._ptr, other._ptr))
1071897
private static boolean polylineDisjointPolyline_(Polyline polyline_a,
			Polyline polyline_b, double tolerance,
			ProgressTracker progress_tracker) {
		// Quick rasterize test to see whether the the geometries are disjoint.
		if (tryRasterizedContainsOrDisjoint_(polyline_a, polyline_b, tolerance,
				false) == Relation.disjoint)
			return true;

        MultiPathImpl multi_path_impl_a = (MultiPathImpl)polyline_a._getImpl();
        MultiPathImpl multi_path_impl_b = (MultiPathImpl)polyline_b._getImpl();

        PairwiseIntersectorImpl intersector_paths = new PairwiseIntersectorImpl(multi_path_impl_a, multi_path_impl_b, tolerance, true);

        if (!intersector_paths.next())
            return false;

		return !linearPathIntersectsLinearPath_(polyline_a, polyline_b,
				tolerance);
	}
476507
public boolean isMultiPoint() {
    boolean mp = true;
    if (this == UNDEFINED) { mp = false; }
    else if (this == NULL) { mp = false; }
    else if (this == POINT) { mp = false; }
    return mp;
  }
587406
static boolean multiPointEqualsPoint_(MultiPoint multipoint_a,
			Point point_b, double tolerance, ProgressTracker progress_tracker) {
		Envelope2D env_a = new Envelope2D(), env_b = new Envelope2D();
		multipoint_a.queryEnvelope2D(env_a);
		point_b.queryEnvelope2D(env_b);
		return envelopeEqualsEnvelope_(env_a, env_b, tolerance,
				progress_tracker);
	}
122132
public static boolean intersects(Bbox one, Bbox two) {
		if (two.getX() > one.getMaxX()) {
			return false;
		}
		if (two.getY() > one.getMaxY()) {
			return false;
		}
		if (two.getMaxX() < one.getX()) {
			return false;
		}
		if (two.getMaxY() < one.getY()) {
			return false;
		}
		return true;
	}