I am working on a texturing algorithm for 3d graphics and I am trying to rotate triangles that are attached at a point so that they are connected (share a single edge) I am using
$\arctan( \frac{m1 - m2}{1 + m1*m2} )$ where $m1 \gt m2$
This is working well in some test cases but not in all... I have two lines one with slope ~1 and ~-.3 which gets me
$\arctan(\frac{1.05555556+0.368567038}{1 + 1.05555556*-0.368567038)})$ = 1.16553753 radians = ~66 degrees
This is correct if the line with slope -.3 is moving down to the right while the line with slope 1 is moving up to the right however the direction of the -.3 slope is moving up and to the left. Is there a way to parameterize this function so that I can provide the direction the lines moving in? Thanks.