![](https://secure.gravatar.com/avatar/7300d3eb9b50cf7e8728cb7991d01275.jpg?s=120&d=mm&r=g)
I don't think an atantwo is needed. I *thought* I had read somewhere that atan( y, x ) was equivalent to calling atan2 in Lua. Ensuring there's no breakage when x == y would be nice, though. It was a little surprising to see angle return degrees rather than radians, but it does simplify my code: dc := vbc - vac; dr := vbr - var; vi := 0; if not( dc == dr ): vi := round( angle( dc, dr ) / 60 ); fi; % Compute the direction towards the first segment (to vertex of an edge). vangle := vi * 60 * pi / 180; Even simpler would be: dc := vbc - vac; dr := vbr - var; vi := round( angle( dc, dr ) / 60 ); % returns 0 when dc == dr % Compute the direction towards the first segment (to vertex of an edge). vangle := vi * 60 * pi / 180; Or accepting a third argument as the return value in the special case: vi := round( angle( dc, dr, 0 ) / 60 ); % returns 0 when dc == dr Cheers!