#! python import math import sys sceneinfo = [] class point: def __init__(self, xloc, yloc): self.x = xloc self.y = yloc self.name = "unnamed" def rotateorigin(self, degrees): radians = degrees * math.pi / 180.0 return point(self.x * math.cos(radians) - self.y * math.sin(radians), self.x * math.sin(radians) + self.y * math.cos(radians)) def rotate(self, degrees, xorigin, yorigin): rot = point(self.x - xorigin, self.y - yorigin).rotateorigin(degrees) return point(rot.x + xorigin, rot.y + yorigin) def translate(self, x, y): return point(self.x + x, self.y + y) class actor: _width = 80 _depth = 48 def __init__(self, boyOrGirl, x, y, angle): self._x = x self._y = y self._angle = angle self.stored_handpos = {} self.name = boyOrGirl if boyOrGirl == "boy": self._isGirl = False self._class = "boy" else: self._isGirl = True self._class = "girl" def center(self): return point(self._x, self._y) def point(self, id): pt = self.pointrel(id).rotateorigin(self._angle).translate(self._x, self._y) pt.name = self.name + " " + id return pt def pointrel(self, id): if id == "center": return point(0, 0) elif id == "L shoulder": return point(self._width/2 - 2, -self._depth/2 + 2) elif id == "R shoulder": return point( - self._width/2 + 2, -self._depth/2 + 2) elif id == "L hip": return point(self._width/2 - 2, -self._depth/2 + 2) elif id == "R hip": return point( - self._width/2 + 2, -self._depth/2 + 2) elif id == "mid-lower back": return point(0, -self._depth/2 + 2) elif id == "L arm": return point(self._width/2 - 2, 0) elif id == "R arm": return point( - self._width/2 + 2, 0) elif id == "ribcage": return point(0, - self._depth / 2 + 2) elif id == "L outward": return point(self._width, self._depth) elif id == "R outward": return point(- self._width, self._depth) elif id == "L in front": return point(self._width / 2, self._depth) elif id == "R in front": return point(- self._width / 2, self._depth) elif id == "L neutral": return point(self._width / 2, self._depth / 2) elif id == "R neutral": return point(- self._width / 2, self._depth / 2) def armto(self, origid, dest): orig = self.point(origid + " arm") print '' global sceneinfo sceneinfo.append(self.name + ": " + orig.name + " to " + dest.name) dest.name = self.name + " " + origid + " hand [" + dest.name + "]" self.stored_handpos[origid] = dest def handpos(self, hand): dest = self.stored_handpos[hand] return dest def draw(self): x = self._x y = self._y if self._isGirl: symbol = "girl" else: symbol = "boy" print ' ' def fileheader(filetitle): print """ """ + filetitle + """

""" + filetitle + """

$Id$

""" def startscene(title): print "

" + title + "

" print """ """ def endscene(): global sceneinfo print " " print " " def filefooter(): print """ """ fileheader("2007 08 15 - Level 3") startscene("R-L-L-R") boy = actor("boy", 100, 120, 180) boy.draw() girl = actor("girl", 100, 34, 0) girl.draw() boy.armto("R", boy.point("R in front")) boy.armto("L", boy.point("L in front")) girl.armto("R", boy.handpos("L")) girl.armto("L", boy.handpos("R")) endscene() startscene("After 1/4 side turn, RH high, LH over head then release and retake") boy = actor("boy", 50, 100, 90) boy.draw() girl = actor("girl", 100, 34, 0) girl.draw() boy.armto("R", boy.point("R shoulder")) boy.armto("L", boy.point("mid-lower back")) girl.armto("R", boy.handpos("L")) girl.armto("L", boy.handpos("R")) endscene() startscene("1 - bounce with R arm") boy = actor("boy", 50, 100, 110) boy.draw() girl = actor("girl", 100, 34, 0) girl.draw() boy.armto("R", girl.point("L shoulder")) boy.armto("L", boy.point("mid-lower back")) girl.armto("R", boy.handpos("L")) girl.armto("L", boy.handpos("R")) endscene() startscene("2 - turn boy CCW, girl CW") boy = actor("boy", 50, 40, 0) boy.draw() girl = actor("girl", 100, 100, 180) girl.draw() boy.armto("R", girl.point("L in front")) boy.armto("L", boy.point("L neutral")) girl.armto("R", girl.point("R neutral")) girl.armto("L", boy.handpos("R")) endscene() filefooter()