在这里,我们将看到一个最大的Reuleaux三角形的面积,它被内切于一个正方形中,该正方形又被内切于一个直角三角形中。正方形的边长为'a'。Reuleaux三角形的高度为x。三角形的底边为b,高度为l,斜边为h。
我们知道,内切于高度为l和底边为b的直角三角形中的正方形的边长为-
Reuleaux三角形的高度与a相同。所以a = x。因此,Reuleaux三角形的面积为-
例子
'#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