예제 #1
0
파일: pairs.py 프로젝트: rmedina0531/PyLogo
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
예제 #2
0
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