Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- int main()
- {
- double x[3];
- double y[3];
- const double PI = acos(-1.0);
- for (int i = 0; i < 3; ++i)
- cin >> x[i] >> y[i];
- double medPointX, medPointY;
- medPointX = x[1] + ((x[0] + x[2]) / 2 - x[1]) * 2 / 3;
- medPointY = y[1] + ((y[0] + y[2]) / 2 - y[1]) * 2 / 3;
- for (int i = 0; i < 2; ++i)
- {
- for (int j = i + 1; j < 3; ++j)
- {
- double fVectorX = x[i] - medPointX,
- fVectorY = y[i] - medPointY,
- sVectorX = x[j] - medPointX,
- sVectorY = y[j] - medPointY;
- double scalar = fVectorX * sVectorX + fVectorY * sVectorY;
- double a_len = sqrt(fVectorX * fVectorX + fVectorY * fVectorY);
- double b_len = sqrt(sVectorX * sVectorX + sVectorY * sVectorY);
- double alpha = acos(scalar / (a_len*b_len))*180/PI;
- cout.precision(2);
- cout << fixed << alpha << endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement