heading angle calculation using atan2 I am trying to find heading angle for my three wheeled robot my robot setup is as below

I know all co-ordinate values.
(x1 y1) (x2 y2) two back wheels and (x3 y3) is front wheel co-ordinate
(xm ym) is the midpoint of (x1 y1) and (x2 y2)
(xt yt) is the target point
I am trying to find angle between (x3 y3) and (xt yt)
For the first case angle range must be  0 to +180 and for second case angle range must be  0 to -180 to make necessary turnings.
How can I use atan2 method for this? Is there any other better method to find angle in the necessary range?

You have a line from (xm,ym) to (x3,y3) and another line between (xm,ym) and (xy,yt).
Now all you interesting in is the angle between the two lines. 
The answer is here.
This is officially unanswered question, but the correct answer is there. 
Pick up the one with highest votes (Rory Daulton) and you good. Just use $\mathrm{atan2}$ instead of $\tan^{-1}$
