Lines Matching refs:self
22 def __init__(self, home=(0,0)):
23 self.__home = [home[0], home[1]]
24 self.__pos = self.__home[:]
25 self.__heading = -90
26 self.__path = ""
27 self.__draw = True
28 self.__new = True
29 def forward(self,mag):
30 self.setpos((self.__pos[0] + math.cos(math.radians(self.__heading))*mag,
31 self.__pos[1] + math.sin(math.radians(self.__heading))*mag))
32 def backward(self,mag):
33 self.setpos((self.__pos[0] - math.cos(math.radians(self.__heading))*mag,
34 self.__pos[1] - math.sin(math.radians(self.__heading))*mag))
35 def right(self,deg):
36 self.__heading -= deg
37 def left(self,deg):
38 self.__heading += deg
39 def penup(self):
40 self.__draw = False
41 self.__new = False
42 def pendown(self):
43 if not self.__draw:
44 self.__new = True
45 self.__draw = True
46 def pentoggle(self):
47 if self.__draw:
48 self.penup()
50 self.pendown()
51 def home(self):
52 self.setpos(self.__home)
53 def clean(self):
54 self.__path = ''
55 def clear(self):
56 self.clean()
57 self.home()
58 def setpos(self,(x,y)):
59 if self.__new:
60 self.__path += "M"+",".join([str(i) for i in self.__pos])
61 self.__new = False
62 self.__pos = [x, y]
63 if self.__draw:
64 self.__path += "L"+",".join([str(i) for i in self.__pos])
65 def getpos(self):
66 return self.__pos[:]
67 def setheading(self,deg):
68 self.__heading = deg
69 def getheading(self):
70 return self.__heading
71 def sethome(self,(x,y)):
72 self.__home = [x, y]
73 def getPath(self):
74 return self.__path