Home  >  Article  >  Backend Development  >  In C, the largest Reuleaux triangle inside a square

In C, the largest Reuleaux triangle inside a square

王林
王林forward
2023-09-07 12:29:011381browse

A Lule Triangle is a shape formed by the intersection of three disks, with the center of each disk on the boundary of the other two disks. Its boundary is a curve of constant width, and apart from the circle itself, it is the simplest and best-known such curve. Constant width means that the spacing between each two parallel support lines is the same, regardless of their orientation. Because all its diameters are the same.

In C, the largest Reuleaux triangle inside a square

The boundary of the Lule triangle is a constant-width curve based on an equilateral triangle. All points on an edge are equidistant from the opposite vertex.

In C, the largest Reuleaux triangle inside a square

Construct a Lule triangle

The formula of Lule triangle

If the curve is based on an equilateral triangle, the side length of the triangle is h , then the area of ​​the Reuleaux triangle is

A = (&pi; * h<sup>2</sup>) / 2 &ndash; 2 * (Area of equilateral triangle) = (&pi; &ndash; &radic;3) * h<sup>2</sup> / 2 = 0.70477 * h<sup>2</sup>

Find the largest Reuleaux triangle inside a square

In C, the largest Reuleaux triangle inside a square

Let us give an example,

Input: a = 6
Output: 25.3717

Explanation

The area of ​​Reuleaux triangle is 0.70477 * b2, where b is the distance between parallel lines Support Reuleaux triangle .

The distance between the parallel lines supporting the Reuleaux triangle = the side length of the square, that is, a

The area of ​​the Reuleaux triangle, A = 0.70477 * a2

##Example

#include <stdio.h>
#include <math.h>
int main() {
   float a = 6;
   float area = 0.70477 * pow(a, 2);
   printf("The area is : %f",area);
   return 0;
}

Output

The area is : 25.371719

The above is the detailed content of In C, the largest Reuleaux 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