As I need it a few times in the code I’m about to write, I just thought that something like Range::getCenter
which would return the central value between start and end would be a useful and simple addition to the Range
class. Maybe you have 5 minutes left to implement it
Oh and I think of course it would have to be getCentre
to be compatible to the JUCE coding style - am I right? (No native english speaker…)
I’m reluctant to add this - it doesn’t generalise well to integers. All the existing built-in methods avoid multiplication and division for this reason.
A user-supplied free function is the way to go here.
Okay, sounds completely sensible - didn’t think about integers as I was working with float Ranges for some hours now