dist/index.js
function(r) {
    r = Object.assign(r, {
        C: 90
    });

    r.A = r.A || 90 - r.B;
    r.B = r.B || 90 - r.A;

    var arad = toRadians(r.A);

    // sinA = a/c
    // a = c * sinA
    // tanA = a/b
    // a = b * tanA
    r.a = r.a || (r.c ? r.c * Math.sin(arad) : r.b * Math.tan(arad));

    // sinA = a/c
    r.c = r.c || r.a / Math.sin(arad);

    // tanA = a/b
    r.b = r.b || r.a / Math.tan(arad);

    return r;
}
function(r) {
    r = Object.assign(r, {
        C: 90
    });

    r.A = r.A || 90 - r.B;
    r.B = r.B || 90 - r.A;

    var arad = toRadians(r.A);

    // sinA = a/c
    // a = c * sinA
    // tanA = a/b
    // a = b * tanA
    r.a = r.a || (r.c ? r.c * Math.sin(arad) : r.b * Math.tan(arad));

    // sinA = a/c
    r.c = r.c || r.a / Math.sin(arad);

    // tanA = a/b
    r.b = r.b || r.a / Math.tan(arad);

    return r;
}
function ( r ) { r = Object . assign ( r , { C : 90 } ) ; r . A = r . A || 90 - r . B ; r . B = r . B || 90 - r . A ; var arad = toRadians ( r . A ) ; // sinA = a/c // a = c * sinA // tanA = a/b // a = b * tanA r . a = r . a || ( r . c ? r . c * Math . sin ( arad ) : r . b * Math . tan ( arad ) ) ; // sinA = a/c r . c = r . c || r . a / Math . sin ( arad ) ; // tanA = a/b r . b = r . b || r . a / Math . tan ( arad ) ; return r ; }
Solve a partial triangle object. Angles are in degrees.
Angle `C` is set to 90 degrees.
@param  {Number} r.a Length of side `a`
@param  {Number} r.A Angle `A` in degrees
@param  {Number} r.b Length of side `b`
@param  {Number} r.B Angle `B` in degrees
@param  {Number} r.c Length of side `c`
@return {Object}   A solved triangle object {A,B,C,a,b,c}
Solve a partial triangle object . Angles are in degrees . Angle C is set to 90 degrees .