Home > Article > Backend Development > In C, the largest Reuleaux triangle inside a square
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.
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.
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 = (π * h<sup>2</sup>) / 2 – 2 * (Area of equilateral triangle) = (π – √3) * h<sup>2</sup> / 2 = 0.70477 * h<sup>2</sup>
Find the largest Reuleaux triangle inside a square
Let us give an example,
Input: a = 6 Output: 25.3717
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; }
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!