2eb36c18bd4fc8db52b93cff763e67364109117f,homeassistant/util/location.py,,distance,#Any#Any#Any#Any#,35
Before Change
in decimal degrees on the earth using the Haversine algorithm.
// convert decimal degrees to radians
lon1, lat1, lon2, lat2 = (radians(val) for val in (lon1, lat1, lon2, lat2))
dlon = lon2 - lon1
dlat = lat2 - lat1
angle = sin(dlat/2)**2 + cos(lat1) * cos(lat2) * sin(dlon/2)**2
// Radius of earth in meters.
radius = 6371000
return 2 * radius * asin(sqrt(angle))
After Change
def distance(lon1, lat1, lon2, lat2):
Calculate the distance in meters between two points.
return vincenty((lon1, lat1), (lon2, lat2)) * 1000
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 7
Instances
Project Name: home-assistant/home-assistant
Commit Name: 2eb36c18bd4fc8db52b93cff763e67364109117f
Time: 2015-09-29
Author: paulus@paulusschoutsen.nl
File Name: homeassistant/util/location.py
Class Name:
Method Name: distance
Project Name: pavlin-policar/openTSNE
Commit Name: 235ca2e812585db5b6bf915054f3c96fc318bb53
Time: 2021-03-12
Author: pavlin.g.p@gmail.com
File Name: openTSNE/tsne.py
Class Name: gradient_descent
Method Name: __call__
Project Name: nipy/dipy
Commit Name: 3c4ffa6b9e64f6d521fe27b1d3bfd503a4df5f59
Time: 2010-06-29
Author: matthew.brett@gmail.com
File Name: dipy/core/tests/test_geometry.py
Class Name:
Method Name: test_sphere_distance