math - How do you calculate the height of a triangle given only the hypotenuse and the ratio of the other two sides? -


There are two types of TV: Traditional aspect ratio of 4: 3 and 16: 9 with wide screen. I am trying to write a function which diagonals of 4: 3 TV with equal height of 16: 9 TV diagonal. I know that I can use Pythagoras' theorem if I know two sides, but I only know diagonals and ratios.

I have written a work that works by guessing, but I was wondering if there is a better way.

My attempt is yet to be:

  // C # public static void Main () {/ * * h = height * w = width * d = diagonal * / Const double maxguess = 40.0; Const Double Double Accuracy = 0.0001; Const Double Target = 21.5; Double ratio 4by 3 = 4.0 / 3.0; Double ratio 16by 9 = 16.0 / 9.0; For (double H = 1; H & LT; magus; H + = accuracy) {double W = H * ratio 16B 9; Double D = Math.Sqrt (Math.Pow (H, 2.0) + Math.Pow (w, 2.0)); If (D> = Target) {Double H1 = H; Double w1 = h1 * ratio 4by3; Double D1 = monastery Class R (Math Pow (h1, 2.0) + Math Po (w1, 2.0)); Console.light line ("4: 3 width: {0: 0.00} height: {1:00} diagram: {2: 0.00}", w, h, d); Console.light line ("16: 9 width: {0: 0.00} height: {1:00} diagram: {2: 0.00}", W1, H1, D1); Return; }}}  

Diagonals and ratios are sufficient: -).

Let be diagonal, r: ratio: r = w / h.

Then d² = w² + h²

This follows r²h² + h² = d². It gives you

h² = d² / (r² + 1) which you can solve: -).


Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -