#includeusingnamespacestd;floatareaReuleaux(floata){//sideofsquareisa if(a<0)//ifaisnegativeitisinvalid return-1"/> #includeusingnamespacestd;floatareaReuleaux(floata){//sideofsquareisa if(a<0)//ifaisnegativeitisinvalid return-1">

Home  >  Article  >  Backend Development  >  What is the largest Rayleigh triangle inside a square?

What is the largest Rayleigh triangle inside a square?

WBOY
WBOYforward
2023-09-13 22:49:01942browse

Here we will see the area of ​​the largest Reuleaux triangle inscribed in a square. The side of the square is "a". The height of the Reuleaux triangle is h.

What is the largest Rayleigh triangle inside a square?

The height of the Reuleaux triangle is the same as a. So a=h. So the area of ​​Reuleaux triangle is -

What is the largest Rayleigh triangle inside a square?

Example

#include <iostream>
#include <cmath>
using namespace std;
float areaReuleaux(float a) { //side of square is a
   if (a < 0) //if a is negative it is invalid
      return -1;
   float area = ((3.1415 - sqrt(3)) * (a) * (a))/2;
   return area;
}
int main() {
   float side = 8;
   cout << "Area of Reuleaux Triangle: " << areaReuleaux(side);
}

Output

Area of Reuleaux Triangle: 45.1024

The above is the detailed content of What is the largest Rayleigh triangle inside a square?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete