Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <iomanip>
- using namespace std;
- struct ygol
- {
- double a;
- double cos_ygl, sin_ygl, tg_ygl;
- ygol (double a)
- {
- cos_ygl = cos(a*3.141592653/180.0);
- sin_ygl = sin(a*3.141592653/180.0);
- if (cos_ygl !=0 )
- tg_ygl = sin_ygl/cos_ygl;
- else tg_ygl = INT32_MAX;
- }
- };
- struct direct
- {
- double k = 0, b = 0;
- double parametr = INT32_MAX;
- };
- struct vershina
- {
- double x, y;
- };
- direct stright(vershina one, double k)
- {
- direct stright;
- if (k != INT32_MAX)
- {
- stright.k = k;
- stright.b = one.y - stright.k*one.x;
- }
- else stright.parametr = one.x;
- return stright;
- }
- vershina otvet (direct normal_1, direct normal_2)
- {
- vershina otvet;
- if (normal_1.parametr == INT32_MAX && normal_2.parametr == INT32_MAX)
- {
- otvet.x = (normal_2.b - normal_1.b)/(normal_1.k - normal_2.k);
- otvet.y = normal_1.k*otvet.x + normal_1.b;
- }
- else if (normal_1.parametr != INT32_MAX)
- {
- otvet.x = normal_1.parametr;
- otvet.y = normal_2.k*otvet.x + normal_2.b;
- }
- else if (normal_2.parametr != INT32_MAX)
- {
- otvet.x = normal_2.parametr;
- otvet.y = normal_1.k*otvet.x + normal_1.b;
- }
- return otvet;
- };
- int main ()
- {
- vershina A, B, C;
- double a, b, c;
- direct AC, BC;
- cin >> B.x >> a >> b;
- c = 180.0 - a - b;
- A.x = 0;
- A.y = 0;
- B.y = 0;
- ygol ygol_A(a);
- ygol ygol_B(180 - b);
- // cout << ygol_A.tg_ygl << " " << ygol_B.tg_ygl << endl;
- AC = stright(A, ygol_A.tg_ygl);
- BC = stright(B, ygol_B.tg_ygl);
- C = otvet(AC, BC);
- cout.precision(10);
- cout << fixed << A.x << " " << A.y << endl;
- cout << fixed << B.x << " " << B.y << endl;
- cout << fixed << C.x << " " << C.y << " ";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement