ID:2306991 Oct 20 2017, 6:17 am (Edited on Oct 20 2017, 5:35 pm) Does this maths mean anything to anyone? It was sitting in The Tabletop Simulator. ```proc atan2(x, y) . = (x||y) && (x>=0?arccos(y/sqrt(x*x+y*y)):-arccos(y/sqrt(x*x+y*y))) hypot(x, y) . = sqrt(x*x + y*y) lerp(a, b, t) // lerp(a, b, t) = c . = a*(1-t) + b*t inv_lerp(a, b, c) // inv_lerp(a, b, c) = t . = (a - c) / (a - b) randn(a, b) . = lerp(a, b, rand()) clamp(n, a, b) . = min(max(n, a), b) clamp_angle(angle) . = angle - round(angle, 360) dir2angle(dir) var global/dir2angle[] = list(0, 180, null, 90, 45, 135, 90, -90, -45, -135, -90, null, 0, 180, null) . = (dir in 1 to 15) && dir2angle[dir] sign(n) . = n && n / abs(n) lerp_angle(a, b, c) . = lerp(a, a + clamp_angle(b - a), c) ``` Oct 20 2017, 8:30 am Ter13   atan2 is a function that's used to get an angle in degrees from a coordinate offset. hypot is for calculating the hypotenuse of a triangle from opposite and adjacent lengths. lerp is for interpolating two points between a, b, at distance factor t clamp() is for sensuring n is between a and b clamp_angle is for clamping an angle between 0 and 360 dir2angle converts a dir to an angle in degrees. sign returns positive or negative one depending if the input is positive or negative. Zero if neither. lerp_angle is linear interpolation for an angle in degrees. These are common helper functions when doing basic trig work. 