TIL: lerp being A*(1-t)+B*t, if you lerp between the same value, say A=50 and B=50, you'll get a value that isn't 50, for some values of t. (floats) Kinda obvious in hindsight but surprised I never hit it before. I had to put in a special case for lerp. If (A==B) return A
I would make the argument that the base lerp function should assume a!=b, as a contract. You can assert in debug, but should impose no overhead in release. If users know their data could potentially violate this contract, they can check a==b themselves.
-
-
The idea is that the contract says “if A==B, the result is undefined”. This way, you only pay the cost of checking if you know you may need to. Some use cases may be able to guarantee A!=B and should not have to pay the overhead of checking.
Kiitos. Käytämme tätä aikajanasi parantamiseen. KumoaKumoa
-
-
-
Gotta hard disagree here. You are taking an implementation detail and making it everyone's problem. Everything is trade offs, so there are times when what you say is appropriate, but complicating all calls of lerp is a pretty big con, so not many imo.
-
And more context might be in order :) This is for non real time rendering, so this micro level perf isn't a big deal. The values come straight from data as well. I could check the data and do something about it, but would rather lerp just deal with it.
- Näytä vastaukset
Uusi keskustelu -
Lataaminen näyttää kestävän hetken.
Twitter saattaa olla ruuhkautunut tai ongelma on muuten hetkellinen. Yritä uudelleen tai käy Twitterin tilasivulla saadaksesi lisätietoja.