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

Method draw_arrow

PythonAPI/examples/no_rendering_mode.py:648–661  ·  view source on GitHub ↗

Draws an arrow with a specified color given a transform

(surface, transform, color=COLOR_ALUMINIUM_2)

Source from the content-addressed store, hash-verified

646 draw_broken_line(surface, markings[1], False, markings[2], 2)
647
648 def draw_arrow(surface, transform, color=COLOR_ALUMINIUM_2):
649 """ Draws an arrow with a specified color given a transform"""
650 transform.rotation.yaw += 180
651 forward = transform.get_forward_vector()
652 transform.rotation.yaw += 90
653 right_dir = transform.get_forward_vector()
654 end = transform.location
655 start = end - 2.0 * forward
656 right = start + 0.8 * forward + 0.4 * right_dir
657 left = start + 0.8 * forward - 0.4 * right_dir
658
659 # Draw lines
660 pygame.draw.lines(surface, color, False, [world_to_pixel(x) for x in [start, end]], 4)
661 pygame.draw.lines(surface, color, False, [world_to_pixel(x) for x in [left, start, right]], 4)
662
663 def draw_traffic_signs(surface, font_surface, actor, color=COLOR_ALUMINIUM_2, trigger_color=COLOR_PLUM_0):
664 """Draw stop traffic signs and its bounding box if enabled"""

Callers 2

draw_waypointsFunction · 0.80
draw_transformFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected