Results 1 to 2 of 2

Math Help - Triangles

  1. #1
    Newbie
    Joined
    Jan 2009
    Posts
    2

    Triangles

    I am attempting to develop a javascript program to calculate the angles of a triangle given
    Two Edges and One Angle or Two Angles and One Edge or Three Edges.
    The program then displays the triangle angles and edges.
    The triangle is drawn using two edges(A&B) and the adjacent angle(C).

    see Triangles and Trigonometry

    All is fine when given two edges(A&B) and the adjacent angle(C) or three edges

    Using these values
    I have tested using the edges and angles from entering two edges(A&B) and the adjacent angle(C)
    and substituting opposite angles A and B using the same edges A and B when calculating an opposite angle triangle
    and likewise for one edge and two angles.
    The results make no sense.

    the functions I am using(my javascript interpretation of the text book methods) are:

    for two edges and an opposite angle
    Code:
    function zxcEEA(e,a){ // where e is an array of edges and a an opposite angle
     e=e.sort(function(b,c){ return b-c; });  // to ensure s < 1   e[0] < e[1]
     var d2r=Math.PI/180;
     var s=e[0]*(Math.sin(a*d2r)/e[1]);  // must be < 1
     var a2=Math.asin(s)*180/Math.PI;    // asin = arcsin
     return [a2,180-a-a2];
    }
    Code:
    for  two angles and one edge.
    function zxcEAA(e,a1,a2){
     e*=1; a1*=1; a2*=1;
     var r2d=Math.PI/180,a3=180-a1-a2,c=e/Math.sin(a1*r2d);
     return [c*Math.sin(a2*r2d),c*Math.sin(a3*r2d),a3];
    }
    I have spent ages on this, any assistane would be appreciated.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Newbie
    Joined
    Jan 2009
    Posts
    2
    Just to say that my script is now working and I have found other posts on this form help full especialy reference documents posted by grandad.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Replies: 3
    Last Post: March 19th 2011, 05:42 AM
  2. Triangles
    Posted in the Geometry Forum
    Replies: 2
    Last Post: March 8th 2011, 11:37 AM
  3. Triangles
    Posted in the Geometry Forum
    Replies: 1
    Last Post: April 12th 2009, 06:59 AM
  4. triangles
    Posted in the Geometry Forum
    Replies: 1
    Last Post: March 24th 2009, 08:06 AM
  5. How Many Different Triangles?
    Posted in the Geometry Forum
    Replies: 0
    Last Post: October 16th 2008, 07:29 PM

Search Tags


/mathhelpforum @mathhelpforum