def heading_to_unit_dxdy(heading) -> Velocity: """ Convert a heading to a (dx, dy) pair as a unit velocity """ angle = utils.heading_to_angle(heading) dx = utils.cos(angle) # The -1 accounts for the y-axis being inverted. dy = (-1) * utils.sin(angle) vel = Velocity((dx, dy)) return vel
def _dy(heading): angle = heading_to_angle(heading) delta_y = utils.sin(angle) # make it negative to account for inverted y axis return (-1)*delta_y