proc
get_angle_nums(ax=45,ay=45,bx=45,by=45)
var/val = sqrt((bx - ax) * (bx - ax) + (by - ay) * (by - ay))
if(!val) return 0
var/ar = arccos((bx - ax) / val)
var/deg = round(360 - (by - ay >= 0 ? ar : -ar), 1)
while(deg > 360) deg -= 360
while(deg < 0) deg += 360
return deg
Problem description:
I'm using this to return a degree, it works however I'm having an issue with figuring out how to return the degree of a turf, for movable atoms it works okay.
Any suggestions? Or perhaps simplifications/ improvements ?
If you're using my "absolute position" library, you should be able to use atom.Cx() and atom.Cy() as the (ax, ay) and (bx, by) points. They correspond to the center of the atom's bounding box.
e.g.