コード例 #1
0
ファイル: surface.py プロジェクト: van-Kalsing/UGV-Control
		def get_polygon_record(polygons_records_indexes):
			contains_equivalent_polygons = False
			
			
			for polygon_record_index in polygons_records_indexes:
				polygon_record = self.__polygons_records[polygon_record_index]
				
				
				centers_modules_difference = \
					abs(
						polygon_record['polygon'].center_module \
							- polygon.center_module
					)
					
				if centers_modules_difference < equivalence_distance:
					contains_equivalent_polygons = \
						match_polygons(
							polygon_record['polygon'],
							polygon,
							equivalence_distance
						)
						
					if contains_equivalent_polygons:
						break
				else:
					break
					
					
			if contains_equivalent_polygons:
				return polygon_record_index, polygon_record
			else:
				return None
コード例 #2
0
	def __eq__(self, state):
		if state.__planning_parameters == self.__planning_parameters:
			def iterate_surface_polygons():
				surface_polygons = \
					zip(
						self.__surface_polygons_sequence,
						state.__surface_polygons_sequence
					)
					
				for surface_polygons_pair in surface_polygons:
					yield surface_polygons_pair
					
					
			for surface_polygons_pair in iterate_surface_polygons():
				first_surface_polygon, second_surface_polygon = \
					surface_polygons_pair
					
				are_polygons_equivalent = \
					match_polygons(
						first_surface_polygon,
						second_surface_polygon,
						self.__surface.equivalence_distance
					)
					
				if not are_polygons_equivalent:
					are_states_equivalent = False
					break
			else:
				are_states_equivalent = True
		else:
			are_states_equivalent = False
			
			
		return are_states_equivalent
コード例 #3
0
	def __is_final(self):
		last_surface_polygon = self.__surface_polygons_sequence[-1]
		
		is_final = \
			match_polygons(
				last_surface_polygon,
				self.__planning_parameters.final_polygon,
				self.__surface.equivalence_distance
			)
			
		return is_final
コード例 #4
0
ファイル: surface.py プロジェクト: van-Kalsing/UGV-Control
		def match_edges(first_edge, second_edge):
			are_polygons_equivalent = \
				match_polygons(
					first_edge.polygon,
					second_edge.polygon,
					self.__equivalence_distance
				)
				
			if are_polygons_equivalent:
				are_edges_equivalent = \
					first_edge.first_vertex_index \
						== second_edge.first_vertex_index
						
				are_edges_equivalent &= \
					first_edge.second_vertex_index \
						== second_edge.second_vertex_index
			else:
				are_edges_equivalent = False
				
				
			return are_edges_equivalent