def cos(cls, angle): """ Calculates cosine, with the angle specified in degrees. """ return math.cos(angles.deg_to_rad(angle))
from misc.angles import deg_to_rad, rad_to_deg # Size of the turtle canvas. We assume no user will have a screen # so big that the canvas will be bigger than this. BITMAP_SIZE = Vector((2000, 1200)) PLAYFIELD_SIZE = Vector((200, 200)) # Center of the canvas. origin = BITMAP_SIZE / 2.0 # 4 lambda functions for transforming between the reference frame # that we prefer and the reference frame that wxPython prefers: to_my_angle = lambda angle: rad_to_deg(-angle) - 180 from_my_angle = lambda angle: deg_to_rad(-angle + 180) from_my_pos = lambda pos: -pos + origin to_my_pos = lambda pos: -pos + origin ############## import copy import math import smartsleep import misc.angles as angles import shelltoprocess
def sin(angle): """ Calculates sine, with the angle specified in degrees. """ return math.sin(angles.deg_to_rad(angle))
def cos(angle): """ Calculates cosine, with the angle specified in degrees. """ return math.cos(angles.deg_to_rad(angle))
from vector import Vector from misc.angles import deg_to_rad, rad_to_deg # Size of the turtle canvas. We assume no user will have a screen # so big that the canvas will be bigger than this. BITMAP_SIZE = Vector((2000, 1200)) # Center of the canvas. origin = BITMAP_SIZE / 2.0 # 4 lambda functions for transforming between the reference frame # that we prefer and the reference frame that wxPython prefers: to_my_angle = lambda angle: rad_to_deg(-angle) - 180 from_my_angle = lambda angle: deg_to_rad(-angle + 180) from_my_pos = lambda pos: -pos + origin to_my_pos = lambda pos: -pos + origin ############## class Turtle(object): """ A Turtle object defines a turtle by its attributes, such as position, orientation, color, etc. See source of __init__ for a complete list. """ def __init__(self): self.pos = Vector((0, 0))