Replies the squared distance between this segment and the given point.

@param point
@return the squared distance.
6967
@Pure
	public double distanceSquaredSegment(Point3D point) {
		return distanceSquaredSegmentPoint(
				getX1(), getY1(), getZ1(),
				getX2(), getY2(), getZ2(),
				point.getX(), point.getY(), point.getZ());
	}
1075831
public static Point projectPoint(Geometry point, Geometry geometry) {
        if (point == null || geometry==null) {
            return null;
        }
        if (point.getDimension()==0 && geometry.getDimension() == 1) {
            LengthIndexedLine ll = new LengthIndexedLine(geometry);
            double index = ll.project(point.getCoordinate());
            return geometry.getFactory().createPoint(ll.extractPoint(index));
        } else {
            return null;
        }
    }
1362296
@Override
	@Pure
	public final double getDistance(Point2D<?, ?> point) {
		if (isWidePolyline()) {
			return distance(point, getWidth());
		}
		return distance(point, 0);
	}
1299577
public double getProjectedDistance(Atom point) {
		Atom projected = getProjectedPoint(point);
		if( projected == null) {
			// translation only
			return Double.NaN;
		}


		return Calc.getDistance(point, projected);

	}
1204459
public double getDistanceToCenter(Point point) {
        return Nd4j.getExecutioner().execAndReturn(
                        ClusterUtils.createDistanceFunctionOp(distanceFunction, center.getArray(), point.getArray()))
                        .getFinalResult().doubleValue();
    }
538639
public static float pointRectDistance (IRectangle r, IPoint p) {
        return FloatMath.sqrt(pointRectDistanceSq(r, p));
    }
1186423
public Point pointAlongLineSegment(double distance) {
        if (start.x == end.x) {
            // we have a vertical line
            if (start.y > end.y) {
                return new Point(end.x, end.y + distance);
            } else {
                return new Point(start.x, start.y + distance);
            }
        } else {
            double slope = (end.y - start.y) / (end.x - start.x);
            double dx = Math.sqrt((distance * distance) / (1 + (slope * slope)));
            if (end.x < start.x) {
                dx *= -1;
            }
            return new Point(start.x + dx, start.y + slope * dx);
        }
    }
436747
public static int distance (int x1, int y1, int x2, int y2) {
        return (int)Math.sqrt(distanceSq(x1, y1, x2, y2));
    }
1290337
public static double SquaredEuclidean(IntPoint p, IntPoint q) {

        double dx = q.x - p.x;
        double dy = q.y - p.y;
        return dx * dx + dy * dy;

    }
1208303
private static double squaredDistance(FinderPattern a, FinderPattern b) {
    double x = a.getX() - b.getX();
    double y = a.getY() - b.getY();
    return x * x + y * y;
  }
1115176
public double distance(Vector2D vector2d) {
		double a = vector2d.x - x;
		double b = vector2d.y - y;
		return Math.sqrt(a * a + b * b);
	}
616335
function(point) {
      var d2r = Math.PI / 180.0;
      var lat1rad = this.latitude * d2r;
      var long1rad = this.longitude * d2r;
      var lat2rad = point.latitude * d2r;
      var long2rad = point.longitude * d2r;
      var deltaLat = lat1rad - lat2rad;
      var deltaLong = long1rad - long2rad;
      var sinDeltaLatDiv2 = Math.sin(deltaLat / 2);
      var sinDeltaLongDiv2 = Math.sin(deltaLong / 2);
      // Square of half the straight line chord distance between both points.
      var a = ((sinDeltaLatDiv2 * sinDeltaLatDiv2) +
               (Math.cos(lat1rad) * Math.cos(lat2rad) *
                sinDeltaLongDiv2 * sinDeltaLongDiv2));
      a = Math.min(1.0, a);
      return 2 * Math.asin(Math.sqrt(a));
    }
967325
public Point interpolate(double distance) {
        if (distance < 0) {
            return null;
        }

        for (LineSegment segment : this.segments) {
            double length = segment.length();
            if (distance <= length) {
                return segment.pointAlongLineSegment(distance);
            }
            distance -= length;
        }
        return null;
    }
355917
function(p, opt) {

            var segments = this.segments;
            var numSegments = segments.length;
            if (numSegments === 0) return null; // if segments is an empty array

            opt = opt || {};
            var precision = (opt.precision === undefined) ? this.PRECISION : opt.precision;
            var segmentSubdivisions = (opt.segmentSubdivisions === undefined) ? this.getSegmentSubdivisions({ precision: precision }) : opt.segmentSubdivisions;
            // not using localOpt

            var closestPointT;
            var minSquaredDistance = Infinity;
            for (var i = 0; i < numSegments; i++) {

                var segment = segments[i];
                var subdivisions = segmentSubdivisions[i];

                if (segment.isVisible) {
                    var segmentClosestPointT = segment.closestPointT(p, { precision: precision, subdivisions: subdivisions });
                    var segmentClosestPoint = segment.pointAtT(segmentClosestPointT);
                    var squaredDistance = (new Line(segmentClosestPoint, p)).squaredLength();

                    if (squaredDistance < minSquaredDistance) {
                        closestPointT = { segmentIndex: i, value: segmentClosestPointT };
                        minSquaredDistance = squaredDistance;
                    }
                }
            }

            if (closestPointT) return closestPointT;

            // if no visible segment, return end of last segment
            return { segmentIndex: numSegments - 1, value: 1 };
        }
37241
public static double distanceSquared(Point p1, Point p2)
	{
		double x = p2.x - p1.x;
		double y = p2.y - p1.y;
		double z = p2.z - p1.z;
		return x * x + y * y + z * z;
	}
995765
boolean areMiddlePointsClose( Point2D_F64 p0 , Point2D_F64 p1 , Point2D_F64 p2 , Point2D_F64 p3 ) {
		UtilLine2D_F64.convert(p0,p3,line);

		// (computed expected length of a square) * (fractional tolerance)
		double tol1 = p0.distance(p1)*distanceTol;

		// see if inner points are close to the line
		if(Distance2D_F64.distance(line, p1) > tol1 )
			return false;

		double tol2 = p2.distance(p3)*distanceTol;

		if( Distance2D_F64.distance(lineB, p2) > tol2 )
			return false;

		//------------ Now see if the line defined by one side of a square is close to the closest point on the same
		//             side on the other square
		UtilLine2D_F64.convert(p0,p1,line);
		if(Distance2D_F64.distance(line, p2) > tol2 )
			return false;

		UtilLine2D_F64.convert(p3,p2,line);
		if(Distance2D_F64.distance(line, p1) > tol1 )
			return false;

		return true;
	}
666409
private static double distance(double[] pointA, double [] pointB) {
		double distance = 0.0;
		for (int i = 0; i < pointA.length; i++) {
			double d = pointA[i] - pointB[i];
			distance += d * d;
		}
		return Math.sqrt(distance);
	}