What's the common method for “ironing out sharp edges” of a function $g$ defined as follows, for known $a$ and $b$ and $f$ in $\mathbb R$?
$$ g(x) = \max(a, \min(b, f(x)) $$
Quick context: the function determines the position of control points of a Bézier curve as the user drags the mouse around. The control points are calculated based on the start and end point of the curve, but there's a minimum and maximum distance of the control points that's enforced regardless of start/end points.
As the user drags the mouse, these min/max points become obvious as the curve suddenly changes the way it's moving around. It's to be expected, since the graph of how the control point position changes based on the end point has sharp corners because of the min/max restriction.
What's an easy way to make this change more organic (while losing some precision)? In other words, how to transform the function to look more like the following picture?
Any additional formal assumptions that make the problem easier are probably all right. In real life, $f$ itself is nothing crazy with ups and downs and sharps (sorry -- can't put my finger on the exact mathematical term), but it's not necessarily linear.



The standard approach is a function called “smooth step”.
The function $f(x) = 3x^2 - 2x^3$ increases smoothly from $0$ to $1$ as $x$ varies between $0$ and $1$, as shown in your pictures. You can scale and translate this function to suit your needs.