The half-angle formulae are formulae from trigonometry with a variety of uses. One important use is for optimising trigonometric calculations, of the sort often used in 2D geometry. In particular calculations of the form
fSin = Math.sin(fAngle);
fCos = Math.cos(fAngle);
can be done more efficiently.
The half angle formulae all use the tan of the half-angle, that is
With this value of t the three trigonometric ratios for the three angles can be worked out to be
So once tan of the half-angle is calculated no other trigonometry is needed to calculate the three ratios.
Is this any faster? Only marginally. I created a test app, here on Wonderfl, to compare this approach to calculating sin and cos of the angle directly. In my tests it was only 10% quicker, in part due to the additional calculations needed for the formulae above.
10% is not to be ignored in a trigonometric-heavy application (though as I've previously noted, it's often possible to avoid trigonometry altogether). And these formulae or used to boost performance in other ways, such as by working directly with half-angle values, or where tan θ is also needed. The formulae also have uses in more theoretical mathematics, such as in solving equations and evaluating integrals.
No comments:
Post a Comment