17 lines
224 B
Python
17 lines
224 B
Python
|
import math
|
||
|
|
||
|
|
||
|
def toRad(d):
|
||
|
return d/360*2*math.pi
|
||
|
|
||
|
def toDeg(r):
|
||
|
return r*360/2/math.pi
|
||
|
|
||
|
|
||
|
def mapFromTo(x,a,b,c,d):
|
||
|
y=(x-a)/(b-a)*(d-c)+c
|
||
|
return y
|
||
|
|
||
|
def constrain(v,_min,_max):
|
||
|
return min(_max,max(_min,v))
|