4 ms·
There are definitely cases where using polar coordinates or angles (with sin/cos/tan and their inverses) is the right tool for the job. The common problem with
by smoyer 5y ago
There are definitely cases where using polar coordinates or angles (with sin/cos/tan and their inverses) is the right tool for the job. The common problem with using trigonometry in software is that angles repeat every 2pi and tangents can overflow your math system (and in fact are undefined at 1/2pi and 3/2pi).
Many formulas can be reduced to operations on dy/dx but you still have to watch of a zero denominator (when used as a slope). You're right as this is certainly common in 2D games but to some degree, it was originally for performance reasons since you don't want to perform a bunch of trig operations when trying to obtain a reasonable refresh rate.
- amelius 5y agoYeah, the advice shouldn't be "avoid angles", but "avoid discontinuities".