The Plane Triangle Calculator is a Java Script calculator that, given 3 of the 6 elements (sides and interior angles) of a triangle, computes the other 3 elements.
To operate the calculator, first select three known elements of the triangle to "fix" their values by using the check boxes. Next, enter the values of the elements in the upper text boxes corresponding to each element. Last, press the calculate button. Pressing the clear button clears all entries. Possible messages:
NaN -- Not a Number
Return to Contents
The Java Script source code for this program can be viewed by using the View|Source command of your web browser.
You may use or modify this source code in any way you find useful, provided that you agree that the author has no warranty, obligations or liability. You must determine the suitability of this source code for your use.
Return to Contents
A plane triangle is defined by 3 interior angles and 3 line segments. These parameters are not independent.
Law of sines
sin A sin B sin C ----- = ----- = ----- a b c
Law of cosines
a2 = b2 + c2 - 2·b·c·cos A b2 = a2 + c2 - 2·a·c·cos B c2 = a2 + b2 - 2·a·b·cos C
Example
Given, a = 4, c = 7, A = 25°; the remaining parameters are computed using:
C = sin-1 [(c/a)·sin A] law of sines
B = 180.0 - (A + C) sum of interior angles = 180
______________________
b = √ a2 + c2 - 2·a·c·cos B law of cosines
Using the equations above, we get:
C = sin-1 [(7/4)·sin 25°] = 47.7°
B = 180.0 - (25° + 47.7°) = 107.3°
________________________
b = √ 16 + 49 - 56·cos 107.3° = 9.04
There are two possible values of C since the range of sin-1 is
0°...180°. The other possible value is 132.3° which gives
us a second feasible solution:
C = 132.3°
B = 180.0 - (25° + 132.3°) = 22.7°
_______________________
b = √ 16 + 49 - 56·cos 22.7° = 3.65
Area using Hero's formula
In this calculator, the areas of the triangles are computed from the lengths of the three sides, a, b, c using the formula below which was first stated and proved by Hero of Alexandria in the first century AD.
s = (a + b + c)/2 semi perimeter
__________________________
Area = √ s·(s - a)·(s - b)·(s - c)
Hero (or Heron) of Alexandria (~10 AD to ~70 AD) was a Greek engineer. He is most famous for the invention of the first steam engine, the aeolipile. In this device, steam is generated in a boiler and fed into a sphere through a pair of hollow spindles. The sphere would spin from the reaction force created by ejecting the steam under pressure through two angled nozzles.
References/u>
Return to Contents
AbCd Classics - free on-line books