Align part of piecewise function

So I have this equation

$f\left(x\right) = \begin{cases} x & 0 < x \le h \\ -\frac{1}{2}\left(x - \left(h + 1\right)\right)^2 + \left(h + \frac{1}{2}\right) & h < x \le h + 4 \\ -\left(x - \left(h + 5\right)\right)^3 + \left(h - 5\right) & h + 4 < x \le h + 6 \\ \frac{3}{\pi}\sin \left(\pi \left(x - h - 1\right)\right) + \left(h - 6\right) & h + 6 < x \le h + 14 \\ -\ln \left(x - \left(h + \frac{41}{3}\right)\right) + \left(\left(h - 6\right) + \ln \left(\frac{1}{3}\right)\right) & h + 14 < x \\ \end{cases}$


But I want the domains to be aligned like this

And the left side of the domains to be left aligned within the block like this:

One way would be using an array with three l columns instead of cases.

\documentclass[a4paper]{article}
\usepackage{amsmath}
\usepackage{array}
\begin{document}
$f\left(x\right) = \left\{\!\begin{array}{ll@{}>{{}}l} x & 0 & < x \le h \\ -\frac{1}{2}\left(x - \left(h + 1\right)\right)^2 + \left(h + \frac{1}{2}\right) & h & < x \le h + 4 \\ -\left(x - \left(h + 5\right)\right)^3 + \left(h - 5\right) & h + 4 & < x \le h + 6 \\ \frac{3}{\pi}\sin \left(\pi \left(x - h - 1\right)\right) + \left(h - 6\right) & h + 6 & < x \le h + 14 \\ -\ln \left(x - \left(h + \frac{41}{3}\right)\right) + \left(\left(h - 6\right) + \ln \left(\frac{1}{3}\right)\right) & h + 14 & < x \\ \end{array}\right.$

\end{document}


Below \eqmakebox[<tag>][<align>]{<stuff>} ensures all similarly-<tag>ged content have the same width and left <align>ed:

\documentclass{article}

\usepackage{amsmath,eqparbox}

\begin{document}

$f(x) = \begin{cases} x & \eqmakebox[lhs][l]{0} < x \leq h \\ -\frac{1}{2} \bigl( x - (h + 1) \bigr)^2 + (h + \frac{1}{2}) & \eqmakebox[lhs][l]{h} < x \leq h + 4 \\ -\bigl( x - (h + 5) \bigr)^3 + (h - 5) & \eqmakebox[lhs][l]{h + 4} < x \leq h + 6 \\ \frac{3}{\pi} \sin \bigl( \pi (x - h - 1) \bigr) + (h - 6) & \eqmakebox[lhs][l]{h + 6} < x \leq h + 14 \\ -\ln \bigl(x - (h + \frac{41}{3}) \bigr) + \bigl( (h - 6) + \ln (\frac{1}{3}) \bigr) & \eqmakebox[lhs][l]{h + 14} < x \end{cases}$

\end{document}