Tuesday, November 19, 2024
Google search engine
HomeData Modelling & AIArea of Reuleaux Triangle

Area of Reuleaux Triangle

Given an integer h which is the side of an equilateral triangle formed by the same vertices as the Reuleaux triangle, the task is to find and print the area of the Reuleaux triangle. 
 

Examples: 
 

Input: h = 6 
Output: 25.3717
Input: h = 9 
Output: 57.0864 
 

 

Approach: The shape made by the intersection of the three circles ABC is the Reuleaux Triangle and the triangle formed by the same vertices i.e. ABC is an equilateral triangle with side h
 

Now, Area of sector ACB, A1 = (? * h2) / 6 
Similarly, Area of sector CBA, A2 = (? * h2) / 6 
And, Area of sector BAC, A3 = (? * h2) / 6 
So, A1 + A2 + A3 = (? * h2) / 2 
Since, the area of the triangle is added thrice in the sum. 
So, Area of the Reuleaux Triangle, A = (? * h2) / 2 – 2 * (Area of equilateral triangle) = (? – ?3) * h2 / 2 = 0.70477 * h2 
 

Below is the implementation of the above approach: 
 

C++




// C++ Program to find the area
// of Reuleaux triangle
#include <bits/stdc++.h>
using namespace std;
 
// Function to find the Area
// of the Reuleaux triangle
float ReuleauxArea(float a)
{
 
    // Side cannot be negative
    if (a < 0)
        return -1;
 
    // Area of the Reuleaux triangle
    float A = 0.70477 * pow(a, 2);
    return A;
}
 
// Driver code
int main()
{
    float a = 6;
    cout << ReuleauxArea(a) << endl;
    return 0;
}


Java




// Java Program to find the area
// of Reuleaux triangle
 
public class GFG
{
    // Function to find the Area
    // of the Reuleaux triangle
    static double ReuleauxArea(float a)
    {
     
        // Side cannot be negative
        if (a < 0)
            return -1;
     
        // Area of the Reuleaux triangle
        double A = (double)0.70477 * Math.pow(a, 2);
        return A;
    }
     
    // Driver code
    public static void main(String args[])
    {
        float a = 6;
        System.out.println(ReuleauxArea(a)) ;
    }
    // This code is contributed by Ryuga
}


Python3




# Python3 program to find the area
# of Reuleaux triangle
import math as mt
 
# function to the area of the
# Reuleaux triangle
def ReuleauxArea(a):
     
    # Side cannot be negative
    if a < 0:
        return -1
    # Area of the Reauleax triangle
    return 0.70477 * pow(a, 2)
 
# Driver code
a = 6
print(ReuleauxArea(a))
 
# This code is contributed
# by Mohit Kumar       


C#




// C# Program to find the area 
// of Reuleaux triangle 
   
using System;
 
public class GFG
{
    // Function to find the Area 
    // of the Reuleaux triangle 
    static double ReuleauxArea(float a) 
    
       
        // Side cannot be negative 
        if (a < 0) 
            return -1; 
       
        // Area of the Reuleaux triangle 
        double A = (double)0.70477 * Math.Pow(a, 2); 
        return A; 
    
       
    // Driver code 
    public static void Main() 
    
        float a = 6; 
        Console.WriteLine(ReuleauxArea(a)) ; 
    }
}
    // This code is contributed by Subhadeep


PHP




<?php
// PHP Program to find the area
// of Reuleaux triangle
 
// Function to find the Area
// of the Reuleaux triangle
function ReuleauxArea($a)
{
 
    // Side cannot be negative
    if ($a < 0)
        return -1;
 
    // Area of the Reuleaux triangle
    $A = 0.70477 * pow($a, 2);
    return $A;
}
 
// Driver code
$a = 6;
echo ReuleauxArea($a);
 
// This code is contributed
// by Akanksha Rai


Javascript




<script>
// javascript Program to find the area
// of Reuleaux triangle
 
// Function to find the Area
// of the Reuleaux triangle
function ReuleauxArea(a)
{
 
    // Side cannot be negative
    if (a < 0)
        return -1;
 
    // Area of the Reuleaux triangle
    var A = 0.70477 * Math.pow(a, 2);
    return A;
}
 
// Driver code
   
var a = 6;
document.write(ReuleauxArea(a)) ;
 
// This code is contributed by Princi Singh
</script>


Output: 

25.3717

 

Time Complexity: O(1)

Auxiliary Space: O(1)

Feeling lost in the world of random DSA topics, wasting time without progress? It’s time for a change! Join our DSA course, where we’ll guide you on an exciting journey to master DSA efficiently and on schedule.
Ready to dive in? Explore our Free Demo Content and join our DSA course, trusted by over 100,000 neveropen!

Dominic Rubhabha-Wardslaus
Dominic Rubhabha-Wardslaushttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Recent Comments