Home >Backend Development >C++ >What is the largest Ruero triangle inscribed in a square that is a right triangle?
Here we will see the area of a largest Reuleaux triangle inscribed in a square, which in turn is inscribed in a right triangle. The side length of the square is 'a'. The height of Reuleaux's triangle is x. The base of the triangle is b, the height is l, and the hypotenuse is h.
We know that the side length of a square inscribed in a right triangle with height l and base b is -
The height of a Reuleaux triangle is the same as a. So a = x. Therefore, the area of the Reuleaux triangle is -
##Example#include <iostream> #include <cmath> using namespace std; float areaReuleaux(float l, float b) { //l and b are height and base of right angled triangle if (l < 0 || b < 0) //either l or b is negative it is invalid return -1; float a = (l*b)/(l+b); float area = ((3.1415 - sqrt(3)) * (a) * (a))/2; return area; } int main() { float l = 5; float b = 12; cout << "Area of Reuleaux Triangle: " << areaReuleaux(l, b); }
Area of Reuleaux Triangle: 8.77858
The above is the detailed content of What is the largest Ruero triangle inscribed in a square that is a right triangle?. For more information, please follow other related articles on the PHP Chinese website!