Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if not self.saved_location:
self.saved_location = origin_lat, origin_lng, origin_alt
dest_lat, dest_lng, dest_alt = self.saved_location
travel = self.precision
else:
self.saved_location = None
travel = min(total_distance, distance)
position = line.Position(travel)
next_lat = position["lat2"]
next_lng = position["lon2"]
random_azi = uniform(line.azi1 - 90, line.azi1 + 90)
random_dist = uniform(0.0, self.precision)
direct = Geodesic.WGS84.Direct(next_lat, next_lng, random_azi, random_dist)
next_lat = direct["lat2"]
next_lng = direct["lon2"]
next_alt = origin_alt + (travel / total_distance) * (dest_alt - origin_alt) + random_alt_delta()
return next_lat, next_lng, next_alt
for scan_location in reversed(self.SCAN_LOCATIONS.values()):
lat = scan_location["latitude"]
lng = scan_location["longitude"]
radius = scan_location["radius"]
d = math.sqrt(3) * 70
points = [[{'lat2': lat, 'lon2': lng, 's': 0}]]
# The lines below are magic. Don't touch them.
for i in xrange(1, maxint):
oor_counter = 0
points.append([])
for j in range(0, 6 * i):
p = points[i - 1][(j - j / i - 1 + (j % i == 0))]
p_new = Geodesic.WGS84.Direct(p['lat2'], p['lon2'], (j+i-1)/i * 60, d)
p_new['s'] = Geodesic.WGS84.Inverse(p_new['lat2'], p_new['lon2'], lat, lng)['s12']
points[i].append(p_new)
if p_new['s'] > radius:
oor_counter += 1
if oor_counter == 6 * i:
break
cover.extend({"lat": p['lat2'], "lng": p['lon2']}
for sublist in points for p in sublist if p['s'] < radius)
self.COVER = cover
total_distance = inverse["s12"]
if total_distance == 0:
total_distance = self.precision or self.epsilon
if distance == 0:
if not self.saved_location:
self.saved_location = origin_lat, origin_lng, origin_alt
dest_lat, dest_lng, dest_alt = self.saved_location
travel = self.precision
else:
self.saved_location = None
travel = min(total_distance, distance)
direct = Geodesic.WGS84.Direct(origin_lat, origin_lng, inverse["azi1"], travel)
next_lat = direct["lat2"]
next_lng = direct["lon2"]
random_azi = uniform(inverse["azi1"] - 90, inverse["azi1"] + 90)
random_dist = uniform(0.0, self.precision)
direct = Geodesic.WGS84.Direct(next_lat, next_lng, random_azi, random_dist)
next_lat = direct["lat2"]
next_lng = direct["lon2"]
next_alt = dest_alt + random_alt_delta()
return next_lat, next_lng, next_alt
for scan_location in reversed(self.SCAN_LOCATIONS.values()):
lat = scan_location["latitude"]
lng = scan_location["longitude"]
radius = scan_location["radius"]
d = math.sqrt(3) * 70
points = [[{'lat2': lat, 'lon2': lng, 's': 0}]]
# The lines below are magic. Don't touch them.
for i in xrange(1, maxint):
oor_counter = 0
points.append([])
for j in range(0, 6 * i):
p = points[i - 1][(j - j / i - 1 + (j % i == 0))]
p_new = Geodesic.WGS84.Direct(p['lat2'], p['lon2'], (j+i-1)/i * 60, d)
p_new['s'] = Geodesic.WGS84.Inverse(p_new['lat2'], p_new['lon2'], lat, lng)['s12']
points[i].append(p_new)
if p_new['s'] > radius:
oor_counter += 1
if oor_counter == 6 * i:
break
cover.extend({"lat": p['lat2'], "lng": p['lon2']}
for sublist in points for p in sublist if p['s'] < radius)
self.COVER = cover
def set_cover():
lat = SearchConfig.ORIGINAL_LATITUDE
lng = SearchConfig.ORIGINAL_LONGITUDE
d = math.sqrt(3) * 70
points = [[{'lat2': lat, 'lon2': lng, 's': 0}]]
for i in xrange(1, maxint):
oor_counter = 0
points.append([])
for j in range(0, 6 * i):
p = points[i - 1][(j - j / i - 1 + (j % i == 0))]
p_new = Geodesic.WGS84.Direct(p['lat2'], p['lon2'], (j+i-1)/i * 60, d)
p_new['s'] = Geodesic.WGS84.Inverse(p_new['lat2'], p_new['lon2'], lat, lng)['s12']
points[i].append(p_new)
if p_new['s'] > SearchConfig.RADIUS:
oor_counter += 1
if oor_counter == 6 * i:
break
cover = [{"lat": p['lat2'], "lng": p['lon2']}
for sublist in points for p in sublist if p['s'] < SearchConfig.RADIUS]
SearchConfig.COVER = cover
if not self.saved_location:
self.saved_location = origin_lat, origin_lng, origin_alt
dest_lat, dest_lng, dest_alt = self.saved_location
travel = self.precision
else:
self.saved_location = None
travel = min(total_distance, distance)
direct = Geodesic.WGS84.Direct(origin_lat, origin_lng, inverse["azi1"], travel)
next_lat = direct["lat2"]
next_lng = direct["lon2"]
random_azi = uniform(inverse["azi1"] - 90, inverse["azi1"] + 90)
random_dist = uniform(0.0, self.precision)
direct = Geodesic.WGS84.Direct(next_lat, next_lng, random_azi, random_dist)
next_lat = direct["lat2"]
next_lng = direct["lon2"]
next_alt = dest_alt + random_alt_delta()
return next_lat, next_lng, next_alt