def getSquareRingActions(): return ([ RingAction.RingActionFunction(ringClerp, [ul, ur]), RingAction.RingActionFunction(ringClerp, [ur, lr]), RingAction.RingActionFunction(ringClerp, [lr, ll]), RingAction.RingActionFunction(ringClerp, [ll, ul]) ], [0.25, 0.25, 0.25, 0.25])
def getHalfDomeRingActions(): def halfDome(t): return (math.cos(t * math.pi), -math.sin(t * math.pi)) x1 = -1.0 x2 = -1.0 / 3.0 x3 = 1.0 / 3.0 x4 = 1.0 return ([ RingAction.RingActionFunction(ringClerp, [(x1, 0), (x2, 0)]), RingAction.RingActionFunction(ringClerp, [(x2, 0), (x3, 0)]), RingAction.RingActionFunction(ringClerp, [(x3, 0), (x4, 0)]), RingAction.RingActionFunction(halfDome, []) ], [0.25, 0.25, 0.25, 0.25])
def get_keypad(numRings, rng): positions = (RingTracks.center, RingTracks.up, RingTracks.down, RingTracks.left, RingTracks.right, RingTracks.ul, RingTracks.ur, RingTracks.lr, RingTracks.ll) tracks = [] usedPositions = [None] posScale = 0.7 + rng.random() * 0.2 for i in xrange(0, numRings): pos = None while pos in usedPositions: pos = rng.choice(positions) usedPositions.append(pos) scaledPos = [0, 0] scaledPos[0] = pos[0] * posScale scaledPos[1] = pos[1] * posScale action = RingAction.RingActionStaticPos(scaledPos) track = RingTrack.RingTrack([action], [1.0]) tracks.append(track) return (tracks, None, 1.0)
def get_evenCircle_withStationaryCenterRings(numRings, rng): tracks = [] tOffsets = [] numCenterRings = rng.randint(1, numRings - 1) positions = getTightCircleStaticPositions(numCenterRings) for i in xrange(0, numCenterRings): action = RingAction.RingActionStaticPos(positions[i]) track = RingTrack.RingTrack([action]) tracks.append(track) tOffsets.append(0) numOuterRings = numRings - numCenterRings for i in xrange(0, numOuterRings): actions, durations = RingTracks.getCircleRingActions() track = RingTrack.RingTrack(actions, durations) tracks.append(track) tOffsets.append(float(i) / numOuterRings) return (tracks, tOffsets, fullCirclePeriod)
def getPlusLeftRingActions(): return ([ RingAction.RingActionFunction(ringClerp, [(-RingOffset, 0), (-1, 0)]), RingAction.RingActionFunction(ringClerp, [(-1, 0), (-RingOffset, 0)]) ], [0.5, 0.5])
def getPlusRightRingActions(): return ([ RingAction.RingActionFunction(ringClerp, [(RingOffset, 0), (1, 0)]), RingAction.RingActionFunction(ringClerp, [(1, 0), (RingOffset, 0)]) ], [0.5, 0.5])
def getPlusDownRingActions(): return ([ RingAction.RingActionFunction(ringClerp, [(0, -RingOffset), (0, -1)]), RingAction.RingActionFunction(ringClerp, [(0, -1), (0, -RingOffset)]) ], [0.5, 0.5])
def getHorizontalInfinityRingActions(): def horizInfPos(t): return (math.sin(t * 2.0 * math.pi), 0.5 * math.sin(2.0 * t * 2.0 * math.pi)) return ([RingAction.RingActionFunction(horizInfPos, [])], [1.0])
def getVerticalInfinityRingActions(): def vertInfPos(t): return (0.5 * math.sin(2.0 * t * 2.0 * math.pi), math.cos(t * 2.0 * math.pi)) return ([RingAction.RingActionFunction(vertInfPos, [])], [1.0])
def getCircleRingActions(): def circlePos(t): return (math.sin(t * 2.0 * math.pi), math.cos(t * 2.0 * math.pi)) return ([RingAction.RingActionFunction(circlePos, [])], [1.0])
def getHorizontalSlotActions(y): return ([ RingAction.RingActionFunction(ringClerp, [(1, y), (-1, y)]), RingAction.RingActionFunction(ringClerp, [(-1, y), (1, y)]) ], [0.5, 0.5])
def getVerticalSlotActions(x): return ([ RingAction.RingActionFunction(ringClerp, [(x, 1), (x, -1)]), RingAction.RingActionFunction(ringClerp, [(x, -1), (x, 1)]) ], [0.5, 0.5])