It was obvious that I needed to "invert" the aspect value in some way to use it in the necessary way, but the funny thing is that it simply occurred to me that the way to do this would be by dividing 1 by the aspect value. In the end this has proven to be correct, but I simply don't know why.
I could have tried subtracting 1 from the aspect value, but for me it simply didn't feel like it would be the right thing to do. And now that the previous algorithm has proven to be correct, it's clear that I was right about this one being incorrect. However, I don't have a clear answer as to why it is incorrect.
I'm sure that any googling for an explanation would take hours and would be futile, just like when I googled for a circle-drawing algorithm that would work in the way I needed (producing horizontal coordinates using vertical coordinates as a base, instead of being based on angles). In the end, I solved both cases myself.
Situations like this makes me feel a bit insecure, because it's as if I'm finding solutions by just banging my head on the keyboard instead of understanding how those things work.
Does anyone else here go through something similar?