📜  等腰梯形上刻有圆圈的区域

📅  最后修改于: 2021-04-29 12:07:22             🧑  作者: Mango

给定等腰梯形ABCD的两个底面ab ,任务是找到该梯形内切面积

例子:

Input: a = 10, b = 30 
Output: Area = 235.57

Input: a = 20, b = 36 
Output: Area = 565.38

推导:给定一个梯形ABCD中的圆(边AB = n和CD = m),我们需要找出梯形的高度,即(AL),该高度是圆的半径的一半,以求出面积圈子。

为了找到圆的高度,我们进行以下操作。

  1. 圆将始终在其中点处接触梯形的侧面,假设AB,BD,CD,AC的中点为G,F,H,E,并将它们与圆心连接在一起。
  2. 现在从对称中,我们可以看到
AG = AE = n/2, 
EC = CG = m/2, 
HD = DF = n/2,
GB = FB = m/2
  1. 现在在三角形ACL中应用毕达哥拉斯定理。
Hypotenuse AC = m/2 + n/2
Base CL = CH - AG = m/2 - n/2

we get 
Perpendicular AL = Square_root(m * n)
  1. 因此,梯形高度= AL = Square_Root(给定边的乘积)
  2. 现在,圆的半径仅为高度的一半,因此可以轻松计算出面积。

方式:

  1. 找出梯形的高度为(square_root(m * n))
  2. 找到圆的半径
R = height / 2 
  = square_root(m * n) / 2
  1. 现在找到圆的区域
= Pi * R2 
= ( 3.141 * m * n ) / 4

下面是上述方法的实现:

C++
// CPP implementation to find
// the rea of the circle
// inscribed in a trapezoid
// having non- parllel sides m, n
#include
using namespace std;
 
// Function to find area of circle
// inscribed in a trapezoid
// having non- parllel sides m, n
double area_of_circle(int m, int n)
{
    // radius of circle by the
    // formula i.e. root( m * n) / 2
    // area of circle = (3.141 ) * ( R ** 2 )
 
    int square_of_radius = ( m * n ) / 4;
    double area = ( 3.141 * square_of_radius );
    return area;
}
 
// Driver Code
int main(){
    int n = 10;
    int m = 30;
    cout << (area_of_circle(m, n));
}
 
// This code is contributed by mohit kumar 29


Java
// Java Program to find
// the rea of the circle
// inscribed in a trapezoid
// having non- parllel sides m, n
class GFG
{
     
    // Function to find area of circle
    // inscribed in a trapezoid
    // having non- parllel sides m, n
    static double area_of_circle(int m, int n)
    {
        // radius of circle by the
        // formula i.e. root( m * n) / 2
        // area of circle = (3.141 ) * ( R ** 2 )
     
        int square_of_radius = ( m * n ) / 4;
        double area = ( 3.141 * square_of_radius );
        return area;
    }
     
    // Driver code
    public static void main (String[] args)
    {
        int n = 10;
        int m = 30;
        System.out.println(area_of_circle(m, n));
    }
}
 
// This code is contributed by Yash_R


Python3
# Python 3 implementation to find
# the rea of the circle
# inscribed in a trapezoid
# having non- parllel sides  m, n
 
 
# Function to find area of circle
# inscribed in a trapezoid
# having non- parllel sides  m, n
def area_of_circle(m, n):
    # radius of circle by the
    # formula i.e. root( m * n) / 2
    # area of circle = (3.141 ) * ( R ** 2 )
     
    square_of_radius = ( m * n ) / 4
    area = ( 3.141 * square_of_radius )
    return area
 
# Driver Code
if __name__=='__main__':
    n = 10
    m = 30
    print(area_of_circle(m, n))


C#
// C# Program to find
// the rea of the circle
// inscribed in a trapezoid
// having non- parllel sides m, n
using System;
 
class GFG
{
     
// Function to find area of circle
// inscribed in a trapezoid
// having non- parllel sides m, n
static double area_of_circle(int m, int n)
{
    // radius of circle by the
    // formula i.e. root( m * n) / 2
    // area of circle = (3.141 ) * ( R ** 2 )
 
    int square_of_radius = ( m * n ) / 4;
    double area = ( 3.141 * square_of_radius );
    return area;
}
 
// Driver code
public static void Main ()
{
    int n = 10;
    int m = 30;
    Console.WriteLine(area_of_circle(m, n));
}
}
 
// This code is contributed by Sanjit_Prasad


Javascript


输出:
235.575