step by step:
1. get three points pt1, pt2 and pt3.
2. get the length of each line. store it in variables a, b and c.
3. make sure that c is the shortest line. if c > a, swap a, c. if c > b swap b, c.
4. calculate cos(a^b) from the formula I gave you.
what i have to write so the program automaticly will decide which is the smallest angle?
I wrote:
3. make sure that c is the shortest line. if c > a, swap a, c. if c > b swap b, c.
Line a = Line (p1, p2); That doesn't really do much.. I'll write a function for Pythagoras theorem:
1 2 3 4
float GetLength(Point a, Point b){
return sqrt((a.get_x()-b.get_x())*(a.get_x()-b.get_x()) + (a.get_y()-b.get_y())*(a.get_y()-b.get_y()));
//don;t forget to #include <cmath>
}