Created
January 8, 2017 03:46
-
-
Save sourcepirate/ed7fa4ff979ac28ed3b1c8ecfe308520 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import math | |
def test_propotions(height, width): | |
"""checking the width and height of the number""" | |
return height/width == math.sqrt(2) | |
def get_dimensions(a, b): | |
"""checks it""" | |
if a > b: | |
return a, b | |
else: | |
return b, a | |
def check(x, y): | |
return x/y | |
def scale(d): | |
"""trying folding the canvas""" | |
x, y = get_dimensions(*d) | |
return x, y | |
if __name__ == "__main__": | |
# math.sqrt(2) = 1.414 | |
# lets start with prefixed measurements. width = 500 height = 707 h/w = 1.414 | |
factor = check(707, 500) | |
print(factor) | |
factor = check(*scale([707, 500])) | |
print(factor) | |
factor = check(*scale([707/2, 500])) #folding the paper | |
print(factor) | |
factor = check(*scale([707/2, 500/2])) #folding the paper | |
print(factor) | |
#math.sqrt(3) = 1.732 | |
# let start with prefixed measurements width = 500 height = 866 | |
factor = check(*scale([866, 500])) | |
print(factor) | |
factor = check(*scale([866/2, 500])) # folding the paper | |
print(factor) | |
factor = check(*scale([866/2, 500/2])) # folding the paper | |
print(factor) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment