Need an idea
-
Hello.... I have to write an application that can load one image and let the user draw on it two lines: the application must tell the user the degree among the two lines. Can You help me????? Thanks
If you still remember high school trigonometry, this problem is easy to solve!! OK, here we go.. Let the endpoint of the 1st line be (x1, y1) and (x2, y2) Let the endpoint of the 2nd line be (x3, y3) and (x4, y4). Let the slope of the 1st line be m1 and the 2nd line be m2. [the slope can be calculated by m1 = (y2 - y1)/(x2 - x1)]. Then the angle between the two lines is given by arctan[(m1 - m2)/(1 + m1*m2)]. Of course you have to deal with many other factors and boundary conditions, the type of coordinate system you're using, and convert radian to degree, etc... Hope this helps. Eddie