Skip to content

Instantly share code, notes, and snippets.

@insightcoder
Last active July 26, 2018 20:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save insightcoder/c492a61e44e6906ff8aac2c07210a939 to your computer and use it in GitHub Desktop.
Save insightcoder/c492a61e44e6906ff8aac2c07210a939 to your computer and use it in GitHub Desktop.
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