找到直角三角形的角度

时间:2014-12-18 15:15:42

标签: geometry sin

我正试图找出一个直角三角形的角度。我有一个包含三角形两边长度的数组。我还有一个包含这两点之间的欧几里德距离的数组。我怎样才能找到三角形的角度?换句话说,我怎么做罪,然后arcsin方法找到角度?我只是在寻找与斜边相反的角度。我试图用C ++做这件事。

现在解决了,误解了我被要求做的事情

3 个答案:

答案 0 :(得分:1)

解决方案:如何找到三角形的角度

#include <iostream>
#include <cmath>
using namespace std;
#define radians(x) return x * (180/pi) 

int main()
{

    double opposite, adjacent, angle1, angle2, angle3, choice, radians, hypotenuse;  
    cout << "Opposite: ";
    cin >> opposite;
    cout << "Adjacent: ";
    cin >> adjacent;
    cout << "Radians or Degrees: (R/D)";
    cin >> choice;

    if(choice == "R")
    { 
        angle1 = arctan(adjacent/opposite);
        hypotenuse = opposite\cos(radians(angle1));
        angle2 = arcsin(adjacent\hypotenuse);
        cout << "Angle 1: "<< radians(angle1) << endl;
        cout << "Angle 2: "<< "90\n";  
        cout << "Angle 3: "<< radians(angle2) << endl;
        cout << "Hypotenuse: " << hypotenuse;
    }
    else if(choice = "D")
    {
        angle1 = arctan(adjacent/opposite);
        hypotenuse = opposite\cos((angle1));
        angle2 = arcsin(adjacent\hypotenuse);
        cout << "Angle 1: " << (angle1) << endl;
        cout << "Angle 2: " << "90\n";  
        cout << "Angle 3: " << (angle2) << endl;
        cout << "Hypotenuse: " << hypotenuse;
    }

    return 0;  
}

或只是

angle2 = 180 - (angle1 + 90)

答案 1 :(得分:0)

三角形的边和角度之间的关系是: -

a/sinA = b/sinB = c/sinC

其中&#39; a&#39;是与角度相反的一面&#39; A&#39;。

你知道一个角度让我们说A = 90。然后你可以从上面的方程计算出其他两个角度。

答案 2 :(得分:0)

你有两边的长度,如果你是我们的切线,你可以找到相应边的角度。

此外,一旦找到一个角度,您需要做的就是从中减去90以获得最终角度:

tan(angle) = opposite/adjacent;

angle = arctan(opposite/adjacent);

otherAngle = 90 - angle;
相关问题