Returns true if multipoint_a is within point_b.
762066
private static boolean multiPointWithinPoint_(MultiPoint multipoint_a,
			Point point_b, double tolerance, ProgressTracker progress_tracker) {
		return multiPointEqualsPoint_(multipoint_a, point_b, tolerance,
				progress_tracker);
	}
144067
def _points_within_distance(self, pnt1, pnt2):
        """"""
        if self._get_distance(pnt1, pnt2) <= self.distance:
            return True
        return False
1173673
private static boolean pointContainsEnvelope_(Point2D pt_a,
			Envelope2D env_b, double tolerance, ProgressTracker progress_tracker) {
		return pointEqualsEnvelope_(pt_a, env_b, tolerance, progress_tracker);
	}
1024782
private static boolean multiPointDisjointMultiPoint_(
			MultiPoint multipoint_a, MultiPoint multipoint_b, double tolerance,
			ProgressTracker progress_tracker) {
		return !multiPointIntersectsMultiPoint_(multipoint_a, multipoint_b,
				tolerance, progress_tracker);
	}
674855
@Pure
	public boolean containsPoint(Point2D<?, ?> point) {
		if (point == null) {
			return false;
		}
		for (int i = 0; i < getPointCount(); ++i) {
			final Point2d cur = getPointAt(i);
			if (cur.epsilonEquals(point, MapElementConstants.POINT_FUSION_DISTANCE)) {
				return true;
			}
		}
		return false;
	}
1103363
static boolean linearPathIntersectsPoint_(MultiPath multipathA,
			Point2D ptB, double tolerance) {
		Point2D closest = new Point2D();
		double toleranceSq = tolerance * tolerance;
		SegmentIteratorImpl segIterA = ((MultiPathImpl) multipathA._getImpl())
				.querySegmentIterator();

		GeometryAccelerators accel = ((MultiPathImpl) multipathA._getImpl())
				._getAccelerators();

		if (accel != null) {
			QuadTreeImpl quadTreeA = accel.getQuadTree();
			if (quadTreeA != null) {
				Envelope2D env_b = new Envelope2D();
				env_b.setCoords(ptB);

				QuadTreeImpl.QuadTreeIteratorImpl qt_iter = quadTreeA
						.getIterator(env_b, tolerance);

				for (int e = qt_iter.next(); e != -1; e = qt_iter.next()) {
					segIterA.resetToVertex(quadTreeA.getElement(e));

					if (segIterA.hasNextSegment()) {
						Segment segmentA = segIterA.nextSegment();

						double t = segmentA.getClosestCoordinate(ptB, false);
						segmentA.getCoord2D(t, closest);

						if (Point2D.sqrDistance(ptB, closest) <= toleranceSq) {
							return true;
						}
					}
				}

				return false;
			}
		}
		Envelope2D env_a = new Envelope2D();

		while (segIterA.nextPath()) {
			while (segIterA.hasNextSegment()) {
				Segment segmentA = segIterA.nextSegment();
				segmentA.queryEnvelope2D(env_a);
				env_a.inflate(tolerance, tolerance);

				if (!env_a.contains(ptB)) {
					continue;
				}

				double t = segmentA.getClosestCoordinate(ptB, false);
				segmentA.getCoord2D(t, closest);

				if (Point2D.sqrDistance(ptB, closest) <= toleranceSq) {
					return true;
				}
			}
		}

		return false;
	}
595763
private static boolean polylineTouchesPoint_(Polyline polyline_a,
			Point point_b, double tolerance, ProgressTracker progress_tracker) {
		// Quick rasterize test to see whether the the geometries are disjoint.
		if (tryRasterizedContainsOrDisjoint_(polyline_a, point_b, tolerance,
				false) == Relation.disjoint)
			return false;

		Point2D pt_b = point_b.getXY();
		return linearPathTouchesPointImpl_(polyline_a, pt_b, tolerance);
	}
91935
static boolean polygonRelatePoint_(Polygon polygon_a, Point point_b,
			double tolerance, String scl, ProgressTracker progress_tracker) {
        RelationalOperationsMatrix relOps = new RelationalOperationsMatrix();
        relOps.resetMatrix_();
        relOps.setPredicates_(scl);
        relOps.setAreaPointPredicates_();

        Envelope2D env_a = new Envelope2D();
        polygon_a.queryEnvelope2D(env_a);
        Point2D pt_b = point_b.getXY();

        boolean bRelationKnown = false;
        boolean b_disjoint = RelationalOperations.pointDisjointEnvelope_(pt_b, env_a, tolerance, progress_tracker);

        if (b_disjoint)
        {
            relOps.areaPointDisjointPredicates_(polygon_a);
            bRelationKnown = true;
        }

        if (!bRelationKnown)
        {
            PolygonUtils.PiPResult res = PolygonUtils.isPointInPolygon2D(polygon_a, pt_b, tolerance); // uses accelerator

            if (res == PolygonUtils.PiPResult.PiPInside)
            {// polygon must have area
                relOps.m_matrix[MatrixPredicate.InteriorInterior] = 0;
                relOps.m_matrix[MatrixPredicate.InteriorExterior] = 2;
                relOps.m_matrix[MatrixPredicate.BoundaryInterior] = -1;
                relOps.m_matrix[MatrixPredicate.BoundaryExterior] = 1;
                relOps.m_matrix[MatrixPredicate.ExteriorInterior] = -1;
            }
            else if (res == PolygonUtils.PiPResult.PiPBoundary)
            {
                relOps.m_matrix[MatrixPredicate.ExteriorInterior] = -1;

                double area = polygon_a.calculateArea2D();

                if (area != 0)
                {
                    relOps.m_matrix[MatrixPredicate.InteriorInterior] = -1;
                    relOps.m_matrix[MatrixPredicate.BoundaryInterior] = 0;
                    relOps.m_matrix[MatrixPredicate.InteriorExterior] = 2;
                    relOps.m_matrix[MatrixPredicate.BoundaryExterior] = 1;
                }
                else
                {
                    relOps.m_matrix[MatrixPredicate.InteriorInterior] = 0;
                    relOps.m_matrix[MatrixPredicate.BoundaryInterior] = -1;
                    relOps.m_matrix[MatrixPredicate.BoundaryExterior] = -1;

                    Envelope2D env = new Envelope2D();
                    polygon_a.queryEnvelope2D(env);
                    relOps.m_matrix[MatrixPredicate.InteriorExterior] = (env.getHeight() == 0.0 && env.getWidth() == 0.0 ? -1 : 1);
                }
            }
            else
            {
                relOps.areaPointDisjointPredicates_(polygon_a);
            }
        }

        boolean bRelation = relationCompare_(relOps.m_matrix, scl);
        return bRelation;
	}
143122
private static boolean polygonRelateMultiPoint_(Polygon polygon_a,
			MultiPoint multipoint_b, double tolerance, int relation,
			ProgressTracker progress_tracker) {
		switch (relation) {
		case Relation.disjoint:
			return polygonDisjointMultiPoint_(polygon_a, multipoint_b,
					tolerance, true, progress_tracker);

		case Relation.contains:
			return polygonContainsMultiPoint_(polygon_a, multipoint_b,
					tolerance, progress_tracker);

		case Relation.touches:
			return polygonTouchesMultiPoint_(polygon_a, multipoint_b,
					tolerance, progress_tracker);

		case Relation.crosses:
			return polygonCrossesMultiPoint_(polygon_a, multipoint_b,
					tolerance, progress_tracker);

		default:
			break; // warning fix
		}

		return false;
	}
1126397
static boolean multiPointRelateMultiPoint_(MultiPoint multipoint_a,
			MultiPoint multipoint_b, double tolerance, String scl,
			ProgressTracker progress_tracker) {
		RelationalOperationsMatrix relOps = new RelationalOperationsMatrix();
		relOps.resetMatrix_();
		relOps.setPredicates_(scl);
		relOps.setPointPointPredicates_();

		Envelope2D env_a = new Envelope2D(), env_b = new Envelope2D();
		multipoint_a.queryEnvelope2D(env_a);
		multipoint_b.queryEnvelope2D(env_b);

		boolean bRelationKnown = false;
		boolean b_disjoint = RelationalOperations.envelopeDisjointEnvelope_(
				env_a, env_b, tolerance, progress_tracker);

		if (b_disjoint) {
			relOps.pointPointDisjointPredicates_();
			bRelationKnown = true;
		}

		if (!bRelationKnown) {
			EditShape edit_shape = new EditShape();
			int geom_a = edit_shape.addGeometry(multipoint_a);
			int geom_b = edit_shape.addGeometry(multipoint_b);
			relOps.setEditShapeCrackAndCluster_(edit_shape, tolerance,
					progress_tracker);
			relOps.computeMatrixTopoGraphClusters_(geom_a, geom_b);
			relOps.m_topo_graph.removeShape();
		}

		boolean bRelation = relationCompare_(relOps.m_matrix, relOps.m_scl);
		return bRelation;
	}
803399
def is_point(self):
        

        if self.childCount() == 2:
                if self.child(0).valid_values == float and self.child(1).valid_values == float:
                    return True
        else:
            return False
1062426
private static boolean multiPointCoverageMultiPoint_(
			MultiPoint _multipointA, MultiPoint _multipointB, double tolerance,
			boolean bPerformWithin, boolean bPerformEquals,
			boolean bPerformOverlaps, ProgressTracker progress_tracker) {
		boolean bPerformContains = false;
		MultiPoint multipoint_a;
		MultiPoint multipoint_b;

		if (_multipointA.getPointCount() > _multipointB.getPointCount()) {
			if (bPerformWithin) {
				bPerformWithin = false;
				bPerformContains = true;
			}

			multipoint_a = _multipointB;
			multipoint_b = _multipointA;
		} else {
			multipoint_a = _multipointA;
			multipoint_b = _multipointB;
		}

		AttributeStreamOfInt8 contained = null;

		if (bPerformEquals || bPerformOverlaps || bPerformContains) {
			contained = new AttributeStreamOfInt8(multipoint_b.getPointCount());

			for (int i = 0; i < multipoint_b.getPointCount(); i++)
				contained.write(i, (byte) 0);
		}

		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();

		boolean bWithin = true; // starts off true by default

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

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

			if (!envInter.contains(ptA)) {
				if (bPerformEquals || bPerformWithin)
					return false;
				else {
					bWithin = false;
					continue;
				}
			}

			boolean bPtACovered = false;
			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) {
					if (bPerformEquals || bPerformOverlaps || bPerformContains)
						contained.write(vertex_b, (byte) 1);

					bPtACovered = true;

					if (bPerformWithin)
						break;
				}
			}

			if (!bPtACovered) {
				bWithin = false;

				if (bPerformEquals || bPerformWithin)
					return false;
			}
		}

		if (bPerformOverlaps && bWithin)
			return false;

		if (bPerformWithin)
			return true;

		for (int i = 0; i < multipoint_b.getPointCount(); i++) {
			if (contained.read(i) == 1) {
				if (bPerformOverlaps)
					return true;
			} else {
				if (bPerformEquals || bPerformContains)
					return false;
			}
		}

		if (bPerformOverlaps)
			return false;

		return true;
	}
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);
	}
1187359
private static boolean multiPointEqualsEnvelope_(MultiPoint multipoint_a,
			Envelope envelope_b, double tolerance,
			ProgressTracker progress_tracker) {
		Envelope2D env_a = new Envelope2D(), env_b = new Envelope2D();
		multipoint_a.queryEnvelope2D(env_a);
		envelope_b.queryEnvelope2D(env_b);

		if (env_b.getHeight() > tolerance || env_b.getWidth() > tolerance)
			return false;

		// only true if all the points of the multi_point degenerate to a point
		// equal to the envelope
		return envelopeEqualsEnvelope_(env_a, env_b, tolerance,
				progress_tracker);
	}
555914
@Pure
	public boolean contains(FunctionalPoint3D point) {
		return containsTrianglePoint(
				this.getP1().getX(), this.getP1().getY(), this.getP1().getZ(), 
				this.getP2().getX(), this.getP2().getY(), this.getP2().getZ(), 
				this.getP3().getX(), this.getP3().getY(), this.getP3().getZ(),
				point.getX(), point.getY(), point.getZ(),
				true, 0.);
	}
1096843
private static boolean polygonContainsMultiPoint_(Polygon polygon_a,
			MultiPoint multipoint_b, double tolerance,
			ProgressTracker progress_tracker) {
		Envelope2D env_a = new Envelope2D(), env_b = new Envelope2D();
		polygon_a.queryEnvelope2D(env_a);
		multipoint_b.queryEnvelope2D(env_b);

		// Quick envelope rejection test for false equality.
		if (!envelopeInfContainsEnvelope_(env_a, env_b, tolerance))
			return false;

		// 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 false;

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

        boolean b_interior = false;
        Point2D ptB;

        MultiPathImpl polygon_a_impl = (MultiPathImpl)polygon_a._getImpl();

        Polygon pa = null;
        Polygon p_polygon_a = polygon_a;

        boolean b_checked_polygon_a_quad_tree = false;

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

            if (!env_a.contains(ptB))
                return false;

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

            if (result == PolygonUtils.PiPResult.PiPInside)
                b_interior = true;
            else if (result == PolygonUtils.PiPResult.PiPOutside)
                return false;

            if (!b_checked_polygon_a_quad_tree) {
                if (PointInPolygonHelper.quadTreeWillHelp(polygon_a, multipoint_b.getPointCount() - 1) && (polygon_a_impl._getAccelerators() == null || polygon_a_impl._getAccelerators().getQuadTree() == null)) {
                    pa = new Polygon();
                    polygon_a.copyTo(pa);
                    ((MultiPathImpl) pa._getImpl())._buildQuadTreeAccelerator(Geometry.GeometryAccelerationDegree.enumMedium);
                    p_polygon_a = pa;
                } else {
                    p_polygon_a = polygon_a;
                }

                b_checked_polygon_a_quad_tree = true;
            }
        }

        return b_interior;
	}
165588
private static boolean pointEqualsPoint_(Point2D pt_a, Point2D pt_b,
			double tolerance, ProgressTracker progress_tracker) {
		if (Point2D.sqrDistance(pt_a, pt_b) <= tolerance * tolerance)
			return true;

		return false;
	}