Returns the angle between p2 -> p0 and p2 -> p2
346667
public static final double getAngleBetweenTwoLines(final Point2D p0, final Point2D p1, final Point2D p2)
    {
        return getAngleFromSSS(p0.distance(p1), p1.distance(p2), p0.distance(p2));
    }
1048977
def cart2spher(x, y, z):
    """"""
    hxy = np.hypot(x, y)
    r = np.hypot(hxy, z)
    theta = np.arctan2(z, hxy)
    phi = np.arctan2(y, x)
    return r, theta, phi
998491
def distance_to_point2(self, p2: "Point2") -> Union[int, float]:
        
        return ((self[0] - p2[0]) ** 2 + (self[1] - p2[1]) ** 2) ** 0.5
1072662
def _mid(pt1, pt2):
    
    (x0, y0), (x1, y1) = pt1, pt2
    return 0.5 * (x0 + x1), 0.5 * (y0 + y1)
1091508
def getP2(self):
        
        return Point(self.center[0] + self.radius,
                     self.center[1] + self.radius)
574565
function getDirectionChange(angle1, angle2) {

        var directionChange = Math.abs(angle1 - angle2);
        return (directionChange > 180) ? (360 - directionChange) : directionChange;
    }
202174
function getDistanceVector(position1, position2) {
  if (position1 && position2) {
    var x1 = position1.x,
        y1 = position1.y;
    var x2 = position2.x,
        y2 = position2.y;


    return { x: x2 - x1, y: y2 - y1 };
  } else {
    return { x: 0, y: 0 };
  }
}
711667
def angle(vec1, vec2):
    """"""
    dot_vec = dot(vec1, vec2)
    mag1 = vec1.length()
    mag2 = vec2.length()
    result = dot_vec / (mag1 * mag2)
    return math.acos(result)
1130941
def angleDiff(angle1, angle2, take_smaller=True):
    
    a = np.arctan2(np.sin(angle1 - angle2), np.cos(angle1 - angle2))
    if isinstance(a, np.ndarray) and take_smaller:
        a = np.abs(a)
        # take smaller of both possible angles:
        ab = np.abs(np.pi - a)
        with np.errstate(invalid='ignore'):
            i = a > ab
        a[i] = ab[i]
    return a
3720
def angle_between_vectors(x, y):
    
    dp = dot_product(x, y)
    if dp == 0:
        return 0
    xm = magnitude(x)
    ym = magnitude(y)
    return math.acos(dp / (xm*ym)) * (180. / math.pi)
110900
def distance(p_a, p_b):
    
    return sqrt((p_a.lat - p_b.lat) ** 2 + (p_a.lon - p_b.lon) ** 2)
415894
function getLengthAngle(x1, x2, y1, y2) {
  var xDiff = x2 - x1;

  var yDiff = y2 - y1;

  return {
    length: Math.ceil(Math.sqrt(xDiff * xDiff + yDiff * yDiff)),
    angle: Math.round(Math.atan2(yDiff, xDiff) * 180 / Math.PI)
  };
}
70639
def gate_angle(gate0: Gate, gate1: Gate) -> bk.BKTensor:
    """"""
    return fubini_study_angle(gate0.vec, gate1.vec)
264680
private static double getSqDist(Point p1, Point p2) {
    double dx = p1.longitude() - p2.longitude();
    double dy = p1.latitude() - p2.latitude();
    return dx * dx + dy * dy;
  }
1365462
public static double distance(DLocation p1, DLocation p2) {
		double p1lat = Math.toRadians(p1.getLatitude());
		double p1lon = Math.toRadians(p1.getLongitude());
		double p2lat = Math.toRadians(p2.getLatitude());
		double p2lon = Math.toRadians(p2.getLongitude());
		return distance(p1lat, p1lon, p2lat, p2lon);
	}
947579
def angle_diff(start_a=[0.0], end_a=[0.0], direction=True):
    '''
    '''
    assert isinstance(start_a, list)
    assert isinstance(end_a, list)
    l_angle = len(start_a)
    assert l_angle > 0
    assert l_angle == len(end_a)
    for i in start_a:
        assert isinstance(i, float)
        assert abs(i) <= 2*pi
    for i in end_a:
        assert isinstance(i, float)
        assert abs(i) <= 2*pi
    assert isinstance(direction, bool)

    # Convert True/False to 1/-1
    inv = 2 * int(direction) - 1

    diff = [end_a[i] - start_a[i] for i in range(l_angle)]
    diff = [(2*pi + d) if d < 0.0 else d for d in diff]
    return [d*inv for d in diff]
1316612
function(p1, p2) {
		_tempPoint.x = Math.abs( p1.x - p2.x );
		_tempPoint.y = Math.abs( p1.y - p2.y );
		return Math.sqrt(_tempPoint.x * _tempPoint.x + _tempPoint.y * _tempPoint.y);
	}