最大羅洛三角形內接正方形,正方形內接橢圓?
這裡我們將看到內接正方形內接橢圓的最大羅洛三角形的面積,該正方形內接在橢圓內。我們知道長軸長度是 2a,短軸長度是 2b。正方形的邊長為“x”,羅洛三角形的高度為 h。
我們知道,內接在橢圓(大軸為 2a,小軸為 2b)的正方形邊長為 -
羅洛三角形的高度與 a 相同。因此,h = x。所以羅洛三角形的面積為 -
.
範例
#include <iostream> #include <cmath> using namespace std; float areaReuleaux(float a, float b) { //a and b are half of major and minor axis of ellipse if (a < 0 || b < 0) //either a or b is negative it is invalid return -1; float x = sqrt((a*a) + (b*b)) / (a*b); float area = ((3.1415 - sqrt(3)) * (x) * (x))/2; return area; } int main() { float a = 5; float b = 4; cout << "Area of Reuleaux Triangle: " << areaReuleaux(a, b); }
輸出
Area of Reuleaux Triangle: 0.0722343
廣告