I need to procedurally generate color palettes consisting of several swatches. For each swatch the luminance is given as input, while chroma and hue are chosen using some algorithm.
Since luminance needs to be perceptually fixed I opted for working in LAB color space. I implemented a small C++ LAB class that converts to/from RGB. It appears to be working fine.
In order to manipulate chroma and hue I covert A and B components into polar coordinates where the angle of AB vector represents hue, while its length represents chroma (so called CIEHLC model).
chroma = sqrt(a*a + b*b);
hue = atan2(b, a);
Now rotating this vector shifts the hue while scaling it changes the chroma. So far so good.
The thing is now similar to HSL/HSV color wheel. However, it appears that rotating the AB vector by 180 degrees does not actually result in a complementary hue as it would in the HSL wheel.
So my question is how to go about calculating the correct complementary hue in the LAB color space?