<h2>How does HSLuv work?</h2>
<p>
    HSLuv is defined as a conversion to and from CIELUV&nbsp;LCh. For both
    HSLuv and HPLuv, the first step is to find the chroma bounds for a given
    lightness. These are lines, crossing which will push the color out of the RGB gamut. We define
    a function, <em>getBounds(L)</em> which returns 6 straight lines in slope-intercept format. Each
    of them represents one of three RGB channels being pushed either below 0 or above 1.
</p>
<p><strong>HSLuv:</strong></p>
<ol>
    <li>
        Given a hue (angle), build a ray starting from <em>(0, 0)</em> and find the point where it
        first intersects with one of the bounding lines.
    </li>
    <li>
        The distance from <em>(0, 0)</em> to this point is the maximum chroma for given <em>L</em>
        and <em>H</em>. Scale saturation to be a percentage of this distance.
    </li>
</ol>
<p><strong>HPLuv:</strong></p>
<ol>
    <li>
        Use perpendiculars to find the shortest distance from <em>(0, 0)</em> to one of the
        bounding lines.
    </li>
    <li>
        This distance is the lowest common chroma. For the given <em>L</em> and any <em>H</em>
        let saturation span this distance.
    </li>
</ol>
<p>
    The equations were built and solved using <a href="http://maxima.sourceforge.net/">Maxima</a>,
    and <a href="https://github.com/hsluv/hsluv/tree/master/math">the Maxima files</a> are
    bundled with the code explaining how to get the bounding lines. The rest is simple geometry you
    can see in the reference implementation.
</p>
