MCPcopy Create free account
hub / github.com/AdaCompNUS/summit / get_bounding_box_corners

Function get_bounding_box_corners

PythonAPI/examples/gamma_crowd.py:378–389  ·  view source on GitHub ↗
(actor)

Source from the content-addressed store, hash-verified

376 return carla.Vector2D(v.x, v.y)
377
378def get_bounding_box_corners(actor):
379 bbox = actor.bounding_box
380 loc = carla.Vector2D(bbox.location.x, bbox.location.y) + get_position(actor)
381 forward_vec = get_forward_direction(actor).make_unit_vector()
382 sideward_vec = forward_vec.rotate(np.deg2rad(90))
383 half_y_len = bbox.extent.y
384 half_x_len = bbox.extent.x
385 corners = [loc - half_x_len * forward_vec + half_y_len * sideward_vec,
386 loc + half_x_len * forward_vec + half_y_len * sideward_vec,
387 loc + half_x_len * forward_vec - half_y_len * sideward_vec,
388 loc - half_x_len * forward_vec - half_y_len * sideward_vec]
389 return corners
390
391def get_vehicle_bounding_box_corners(actor):
392 bbox = actor.bounding_box

Callers 1

do_collision_statisticsFunction · 0.70

Calls 4

Vector2DMethod · 0.80
rotateMethod · 0.80
get_positionFunction · 0.70
get_forward_directionFunction · 0.70

Tested by

no test coverage detected