urcontrol/urosc/helpfunctions.py

17 lines
224 B
Python
Raw Normal View History

2024-05-10 08:14:29 +00:00
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))