| ▲ | 20k 7 hours ago | |||||||
>poorly designed third party APIs I think this is missing the reason why these APIs are designed like this: because they're convenient and intuitive Its rare that this kind of performance matters, or that the minor imprecisions of this kind of code matter at all. While its certainly true that we can write a better composite function, it also means that.. we have to write a completely new function for it Breaking things up into simple, easy to understand, reusable representations is good. The complex part about this kinds of maths is not the code, its breaking up what you're trying to do into a set of abstracted concepts so that it doesn't turn into a maintenance nightmare Where this really shows up more obviously is in more real-world library: axis angle rotations are probably a strong type with a lot of useful functions attached to it, to make your life easier. For maths there is always an abstraction penalty, but its usually worth the time saved, because 99.9999% of the time it simply doesn't matter Add on top of this that this code would be optimised away with -ffast-math, and its not really relevant most of the time. I think everyone goes through this period when they think "lots of this trig is redundant, oh no!", but the software engineering takes priority generally | ||||||||
| ▲ | et1337 4 hours ago | parent | next [-] | |||||||
Based on my experience writing many games that work great barring the occasional random physics engine explosion, I suspect that trigonometry is responsible for a significant proportion of glitches. I think over the years I subconsciously learned to avoid trig because of the issues mentioned, but I do still fall back to angles, especially for things like camera rotation. I am curious how far the OP goes with this crusade in their production code. | ||||||||
| ||||||||
| ▲ | newsoftheday 2 hours ago | parent | prev [-] | |||||||
> I think this is missing the reason why these APIs are designed like this: because they're convenient and intuitive Agreed. In my view, the method the author figured out is far from intuitive for the general population, including me. | ||||||||