| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 
 | #include <iostream>#include <cmath>
 #define M_PI acos(-1.0)
 using namespace std;
 
 
 
 
 
 
 
 double get_angle(double x1, double y1, double x2, double y2, double x3, double y3) {
 double theta = atan2(x1 - x3, y1 - y3) - atan2(x2 - x3, y2 - y3);
 if (theta > M_PI)
 theta -= 2 * M_PI;
 if (theta < -M_PI)
 theta += 2 * M_PI;
 
 theta = abs(theta * 180.0 / M_PI);
 return theta;
 }
 
 int main() {
 double x1 = 0;
 double y1 = 1;
 double x2 = 1;
 double y2 = 0;
 double x3 = -1;
 double y3 = -2;
 double angle1 = get_angle(x3, y3, x1, y1, x2, y2);
 double angle2 = get_angle(x1, y1, x2, y2, x3, y3);
 double angle3 = get_angle(x2, y2, x3, y3, x1, y1);
 cout << angle2 << endl;
 cout << angle3 << endl;
 cout << angle1 << endl;
 
 return 0;
 }
 
 
 
 
 |