|Posted by:||Rick C. Hodgin (rick.c.hodg…@gmail.com)|
|Date:||Thu, 13 Sep 2018|
I have a situation where I have three values (v1, v2, v3) and they
have a max value each of 32, but more typically each will be 8 or less.
I need to scale up their values proportionally toward the next
largest multiple of 8 (if they don't already equal a multiple of 8).
v1 = 2
v2 = 3
v3 = 4
Here we have a total of 2+3+4 = 9, which would need to scale up to
16, being as it's the next multiple of 8.
I need the v1, v2, and v3 values to each scale up proportionally,
so that v3 gets the largest increase, v2 the second largest, and
v1 the smallest.
Mathematically I can determine how much they would scale with an
equation. But v1..v3 are integers, and they need to round to the
nearest integer values to be legitimate, which may require rounding
up in some cases, rounding down in others.
I was thinking this problem seems like an anti-aliasing problem,
where perfect geometry is mapped into integer space, rounding up
to the next pixel, or down to the prior one.
I was wondering if anyone can think of an anti-aliasing algorithm
which would help in this case?
Thank you in advance for your assistance.
Rick C. Hodgin