def is_arching_scene(locs, dirs, scene, MAX_ANGLE): # for i in range(scene.start, scene.end, 1): # print locs[i], dirs[i] if (scene.end - scene.start) < 2: return False # print scene.end - scene.start comb = itertools.combinations(range(scene.start, scene.end + 1, 1), 2) for (i, j) in comb: if j != i and dirs[i] != dirs[j]: # non-parallel pairs convergent = True # only consider pair of locations whose distance is less than 1 meter if distance_km(locs[i][0], locs[i][1], locs[j][0], locs[j][1]) < 0.001: continue l_o = interesection_point(locs[i], locs[j], dirs[i], dirs[j]) # find intersection point # print l_o if not l_o: continue for k in range(scene.start, scene.end + 1, 1): if k != i and k != j: # the rest of FOVs if distance_km(l_o[0], l_o[1], locs[k][0], locs[k][1]) > 0.01 * R_100: # print "distance ", distance_km(l_o[0], l_o[1], locs[k][0], locs[k][1]) convergent = False break alpha1 = angle_bwn_points(locs[k], l_o) alpha2 = correct_dir(dirs[k]) # print alpha1, alpha2, MAX_ANGLE if not within_range(alpha1, alpha2, MAX_ANGLE): convergent = False break if convergent: # exist one convergent center --> return True return True return False
def cover(self, plat, plng): angle = angle_bwn_two_points(self.lat, self.lon, plat, plng) distance = distance_km(self.lat, self.lon, plat, plng) # print angle, distance if abs(angle - self.compass / 2) < 30 and distance < self.R: return True else: return False
def cover(self, plat, plng): angle = angle_bwn_two_points(self.lat, self.lon, plat, plng) distance = distance_km(self.lat, self.lon, plat, plng) # print angle, distance if abs(angle - self.compass/2) < 30 and distance < self.R: return True else: return False # print within_circular(34.024734, -118.284988,34.018212,-118.291716,45,1)
def area(self): a = distance_km(self.n_box[0, 0], self.n_box[0, 1], self.n_box[0, 0], self.n_box[1, 1]) * distance_km( self.n_box[0, 0], self.n_box[0, 1], self.n_box[1, 0], self.n_box[0, 1]) return a
def area(self): a = distance_km(self.n_box[0,0],self.n_box[0,1],self.n_box[0,0],self.n_box[1,1]) * distance_km(self.n_box[0,0],self.n_box[0,1],self.n_box[1,0],self.n_box[0,1]); return a