In RGB color space, you can do a weighted multiple-color blend by just doing:
Start with R = G = B = 0. Then we perform a blend at index i using a set of colors C, and a set of normalized weights w like so:
R += w[i] * C[i].r
G += w[i] * C[i].g
B += w[i] * C[i].b
But I'd like to interpolate the colors in the HSV color-space instead, so that saturation and brightness are uniform across the interpolation. I know I can blend saturation and brightness in the same way as above, but the HUE component is an angle around a continuous circle, since HSV is essentially a polar coordinate system.
Blending only two HSV colors makes sense to me, you just find the shortest arc around the circle and interpolate between the two hues. But when you attempt to blend more than 2 colors, it becomes a bit of a puzzle.
You have to handle anomalous cases, like 4 equally-weighted colors with a hue at 0, 90, 180, and 270 degrees. They basically cancel each other out, so any hue will do.
Any ideas would be greatly appreciated.