Allow square element to be a rectangle

This commit is contained in:
2022-09-28 18:42:06 -04:00
parent dd5917cd45
commit e5b6019606
4 changed files with 58 additions and 39 deletions

View File

@ -1,3 +1,5 @@
import math
# sign function
def sgn(x):
if x>=0:
@ -20,3 +22,10 @@ def remove_fromlist(a,x):
a[a.index(x)]=a[len(a)-1]
a=a[:len(a)-1]
return a
# snap to a grid: ceiling
def ceil_grid(x,size):
return math.ceil(x/size)*size
# snap to a grid: floor
def floor_grid(x,size):
return math.floor(x/size)*size