MCPcopy Create free account
hub / github.com/OpenDriveLab/DriveAdapter / vector

Function vector

agents/tools/misc.py:130–141  ·  view source on GitHub ↗

Returns the unit vector from location_1 to location_2 :param location_1, location_2: carla.Location objects

(location_1, location_2)

Source from the content-addressed store, hash-verified

128
129
130def vector(location_1, location_2):
131 """
132 Returns the unit vector from location_1 to location_2
133
134 :param location_1, location_2: carla.Location objects
135 """
136 x = location_2.x - location_1.x
137 y = location_2.y - location_1.y
138 z = location_2.z - location_1.z
139 norm = np.linalg.norm([x, y, z]) + np.finfo(float).eps
140
141 return [x / norm, y / norm, z / norm]
142
143
144def compute_distance(location_1, location_2):

Callers 4

choose_at_junctionFunction · 0.90
get_intersectionFunction · 0.90
_build_graphMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected