Hints 1 ::
https://math.stackexchange.com/questions/1582061/finding-the-radius-of-a-circle-inside-of-a-triangle/1582067#:~:text=use%20the%20fact%20that%20the,valid%20for%20a%20convex%20polygon..
Hints 2 ::
https://www.mathopenref.com/trianglecircumcircle.html
#include<bits/stdc++.h>
using namespace std;
int main()
{
double a, b, c;
double pi = acos(-1);
ios_base :: sync_with_stdio;
cin.tie(NULL);
cout.tie(NULL);
while(cin >> a >> b >> c)
{
double s, triangel, circle1_area, circle2_area, r, R;
s = (a + b + c)/2.0;
triangel = sqrt(s*(s-a)*(s-b)*(s-c));
r = triangel/s;
circle1_area = pi * (r*r);
double d = (a+b+c) * (b+c-a) * (c+a-b) * (a+b-c);
R = (a * b * c) / sqrt(d);
circle2_area = pi * (R * R);
circle2_area = circle2_area - triangel;
triangel = triangel - circle1_area;
cout << showpoint;
cout << fixed;
cout << setprecision(4);
cout << circle2_area << " " << triangel << " " << circle1_area << "\n";
}
return 0;
}
Comments
Post a Comment