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 _dx(heading): angle = heading_to_angle(heading) delta_x = utils.cos(angle) return delta_x