Last active
July 26, 2018 20:35
-
-
Save insightcoder/c492a61e44e6906ff8aac2c07210a939 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyquaternion import Quaternion | |
import math | |
rot180 = Quaternion(axis=[1, 0, 0], angle=math.pi) | |
rot90 = Quaternion(axis=[1, 0, 0], angle=math.pi / 2.0) | |
def microwave(up): | |
print('Microwaving for 4 sec facing [%d, %d, %d]' % tuple(up)) | |
def soften_butter(): | |
up = [0, 0, 1] | |
microwave(up) | |
up = rot180.rotate(up) | |
microwave(up) | |
up = rot90.rotate(up) | |
microwave(up) | |
up = rot180.rotate(up) | |
microwave(up) | |
print('*** DING! ***') | |
if __name__ == '__main__': | |
soften_butter() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment