Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions How to find 3 triangle angles with 3 sides given

  • How to find 3 triangle angles with 3 sides given

    Posted by Mikael Holmström on December 28, 2021 at 7:48 pm

    Hi there,

    I’m struggling with converting the laws of Cosines into a slick expression that determines the angles of of the corners of a triangle. What’s given is the length of each side of the triangle (for instance a = 16, b =20, c = 18).

    mike kleni replied 4 years, 7 months ago 3 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    December 28, 2021 at 8:11 pm

    Like this, I think:

    a =16;
    b = 20;
    c = 18;
    A = radiansToDegrees(Math.acos((b*b + c*c - a*a)/(2*b*c)));
    B = radiansToDegrees(Math.acos((a*a + c*c - b*b)/(2*a*c)));
    C = radiansToDegrees(Math.acos((a*a + b*b - c*c)/(2*a*b)));
  • Mikael Holmström

    December 28, 2021 at 9:21 pm

    Lovely, thank you very much!

    Mikael

  • mike kleni

    January 4, 2022 at 1:51 pm

    Starting with your last question: Note that “height” (or altitude) will be relative to a specific side of your triangle. If you don’t specify which of the three sides you’ve chosen, then we can’t know whether your height is correct relative to that side.

    For your other questions: I’d recommend using the Law of Cosines to compute the measures of the respective angles. I’m getting different answers from yours. This make sense intuitive sense: angle A is opposite the shortest side, so it should be the smallest of the three angles. That wasn’t what you found, though. Important note: When computing the relevant inverse cosines, make sure your output is in degrees or radians, depending on what the exercise specifies.

    For the area of the triangle, you have a few options. One is to compute one of the angles, then use that to compute the triangle’s area, given that you know the measure of an angle and the lengths of the two adjacent sides. Alternatively, you can use Heron’s Formula, which requires only the lengths of the three sides (though it can be a more obscure formula, depending on your background). Hope this helps. Good luck!

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy