title: Javascript function to find third point of triangle when all sides, angles and first two points are known
body: <p>This has been asked before however I've found no satisfactory answers so I'm going to try and makes sure this is on topic and generates some good responses.</p>
  
  <p>This question should not be on maths.stackexchange because it's about the Javascript code required to complete the function I started below.</p>
  
  <p>Imagine the following triangle.</p>
  
  <p><a href="https://i.stack.imgur.com/dsHuW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dsHuW.png" alt="Labeled triangle"></a></p>
  
  <p>Each point A, B and C have x and y coordinates and we know what these coordinates are for Ax, Ay, Cx and Cy.
  We also know the length of a, b and c and the angle of A, B and C.</p>
  
  <p>I want to write a Javascript function to calculate the x and y coordinates of point B but I'm really struggling to convert the maths I've read to Javascript.</p>
  
  <p>Here is the start of the function I'm trying to write:</p>
  
  <pre><code>/**
   * Find the coordinates for the third point of a triangle.
   *
   * @param Ax - x coordinate value of first known point
   * @param Ay - y coordinate value of first known point
   * @param Cx - x coordinate value of second known point
   * @param Cy - y coordinate value of second known point
   * @param a - the length of side a
   * @param b - the length of side b
   * @param c - the length of side c
   * @param A - the angle of corner A in degrees
   * @param B - the angle of corner B in degrees
   * @param C - the angle of corner C in degrees
   * @returns {{Bx: *, By: *}}
   */
  function calculate_third_point(Ax, Ay, Cx, Cy, a, b, c, A, B, C) {
  
      var Bx;
      var By;
  
      // What code goes here?
  
      return {Bx: Bx, By: By};
  }
  </code></pre>
  
  <p>There is a <a href="https://stackoverflow.com/questions/24970605/finding-third-points-of-triangle-using-other-two-points-with-known-distances">closed question on stackoverflow here</a>, however the accepted answer appears to just return one value, P3. But we need an x and a y value for the third point so I don't understand it.</p>
  
  <p>There is <a href="https://math.stackexchange.com/questions/543961/determine-third-point-of-triangle-when-two-points-and-all-sides-are-known">a question on maths.stackexchange</a> but the accepted answer appears to use P and Q that just appear from nowhere and the mathematical symbols make things harder to understand. There are no clear defined inputs and outputs.</p>
  
  <p>There is <a href="https://gist.github.com/Kalagan/d394d210c772a48be067d7e3b856dd1e" rel="nofollow noreferrer">a javascript solution here</a> but it doesn't take into account the x and y coordinates of the first two points.</p>
  
  <p>Can someone help me by completing my function. The solution must just use the provided inputs. If any inputs are not required they may be discarded.</p>