When you're dealing with right-angled triangles, trigonometry is not required to calculate the length of the hypotenuse. Our PHP programmers friends have a function called hypot() which solves for c in the equation: a^2 + b^2 = c^2
function hypot(a, b)
hypot = sqr(a^2 + b^2)
end function
Using the classic 3-4-5 triangle as an example, for a = 3 and b = 4, the function will return 5.
No comments:
Post a Comment