Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <algorithm>
- #include <iomanip>
- using namespace std;
- #define PI 3.14159265
- struct otrezok
- {
- double x1, y1, x2, y2, x, y;
- double length;
- };
- struct vershina
- {
- double x, y;
- };
- vershina yravnenie(double a, double b, double c, double m)
- {
- double x1=0, x2=0, D=0, x = 0, y = 0;
- if ((b==0) && (c==0))
- x = 1;
- else
- {
- D = b*b - 4*a*c;
- x1=(-b+sqrt(D))/2/a;
- x2=(-b-sqrt(D))/2/a;
- if (x1==x2)
- x = x1;
- else
- {
- if (x1 < x2)
- x = x2;
- else x = x1;
- }
- }
- y = (m+b/2/m*x)/b*2*m;
- vershina C;
- C.x = x;
- C.y = y;
- return C;
- }
- int main ()
- {
- otrezok AB, BC;
- double ygol_B;
- cin >> AB.length >> BC.length >> ygol_B;
- vershina B;
- B.x = 0;
- B.y = 0;
- AB.x = -sqrt(AB.length*AB.length/2);
- AB.y = -AB.x;
- double m = AB.length*BC.length*cos(ygol_B*PI/180.0);
- double AC_2 = AB.length*AB.length + BC.length*BC.length - 2*m;
- double a = 2*AB.x*AB.x;
- double b = -2*m*AB.x;
- double c = m*m - b*AB.y + 2*pow(AB.x, 4) - AC_2*a/2;
- vershina C = yravnenie(a, b, c, m);
- cout.precision(6);
- cout << fixed << B.x << " " << B.y << endl;
- cout << fixed << AB.x << " " << AB.y << endl;
- cout << fixed << C.x << " " << C.y << " ";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement