function euclid2d(x1, y1, x2, y2) { return Math.sqrt( Math.pow(x1-x2, 2) + Math.pow(y1-y2, 2) ); } function norm2d(x, y) { return Math.sqrt(x*x + y*y); } function deg2rad(angle) { return angle*(Math.PI/180.0); } function rad2deg(angle) { return angle*(180.0/Math.PI); } function paddingString(s, mask) { size = mask.length; return (mask + s).slice(-size); } function addClass(element, cls) { element.className = element.className + " " + cls; } function removeClass(element, cls) { element.className = ""; } function linear(a, b, t) { return creatine.clip(a + t*(b-a), a, b); } function ilinear(a, b, t) { // return a - t*(a-b); return creatine.clip(a - t*(a-b), b, a); } // function