📜  使用中值的等边三角形的圆周面积

📅  最后修改于: 2021-10-23 08:39:45             🧑  作者: Mango

给定等边三角形M的中位数,任务是使用中位数 M 找到该等边三角形的外接圆面积。
例子:

方法:问题中的关键观察是等边三角形的质心、外心、垂心和内心都在同一点上。

因此,内接等边三角形的给定中值的圆的半径可以推导出为:
\text{Radius of Circumcircle =} \frac{2}{3}*M
然后可以使用本文中使用的方法计算圆的面积
下面是上述方法的实现:

C++
// C++ implementation to find the
// equation of circle which
// inscribes equilateral triangle
// of median M
 
#include 
const double pi = 3.14159265358979323846;
using namespace std;
 
// Function to find the equation
// of circle whose center is (x1, y1)
// and the radius of circle is r
void circleArea(double r)
{
    cout << (pi * r * r);
}
 
// Function to find the
// equation of circle which
// inscribes equilateral triangle
// of median M
void findCircleAreaByMedian(double m)
{
    double r = 2 * m / 3;
 
    // Util Function to find the
    // circle equation
    circleArea(r);
}
 
// Driver code
int main()
{
    double m = 3;
 
    // Function Call
    findCircleAreaByMedian(m);
    return 0;
}


Java
// Java implementation to find the
// equation of circle which
// inscribes equilateral triangle
// of median M
import java.util.*;
 
class GFG{
     
// Function to find the equation
// of circle whose center is (x1, y1)
// and the radius of circle is r
static double circleArea(double r)
{
    double pi = 3.14159265358979323846;
    return (pi * r * r);
}
     
// Function to find the
// equation of circle which
// inscribes equilateral triangle
// of median M
static double findCircleAreaByMedian(int m)
{
    double r = 2 * m / 3;
     
    // Function call to find
    // the circle equation
    return circleArea(r);
}
 
// Driver code
public static void main(String args[])
{
    int m = 3;
     
    System.out.printf("%.4f", findCircleAreaByMedian(m));
}
}
 
// This code is contributed by virusbuddah_


Python3
# Python3 implementation to find the
# equation of circle which inscribes
# equilateral triangle of median M
 
pi = 3.14159265358979323846
 
# Function to find the equation
# of circle whose center is (x1, y1)
# and the radius of circle is r
def circleArea(r):
     
    print(round(pi * r * r, 4))
 
# Function to find the
# equation of circle which
# inscribes equilateral triangle
# of median M
def findCircleAreaByMedian(m):
     
    r = 2 * m /3
 
    # Function to find the
    # circle equation
    circleArea(r)
 
# Driver code
if __name__ == '__main__':
     
    m = 3
 
    # Function call
    findCircleAreaByMedian(m)
 
# This code is contributed by mohit kumar 29


C#
// C# implementation to find the
// equation of circle which
// inscribes equilateral triangle
// of median M
using System;
 
class GFG{
     
// Function to find the equation
// of circle whose center is (x1, y1)
// and the radius of circle is r
static double circleArea(double r)
{
    double pi = 3.14159265358979323846;
    return (pi * r * r);
}
         
// Function to find the
// equation of circle which
// inscribes equilateral triangle
// of median M
static double findCircleAreaByMedian(int m)
{
    double r = 2 * m / 3;
         
    // Function call to find
    // the circle equation
    return circleArea(r);
}
     
// Driver code
public static void Main(string []args)
{
    int m = 3;
         
    Console.WriteLine("{0:f4}", findCircleAreaByMedian(m));
}
}
 
// This code is contributed by AnkitRai01


Javascript


输出:
12.5664