Reuleaux Triangle สร้างจากจุดตัดของวงกลม 3 วง มีสามเหลี่ยมด้านเท่าภายใน ความสูง = h
พื้นที่ = 3 × (พื้นที่ sector 60°) - 2 × (พื้นที่สามเหลี่ยมด้านเท่า)
Area = (π - √3) × h² / 2
โค้ดตัวอย่าง
#include <iostream>
#include <cmath>
using namespace std;
float reuleauxArea(float h) {
if (h < 0) return -1;
return ((M_PI - sqrt(3)) * h * h) / 2;
}
int main() {
float h = 6;
cout << "Area: " << reuleauxArea(h);
return 0;
}
ผลลัพธ์
Area: 25.3701