Class SmoothStepFactory.SmoothStepFunction

  • All Implemented Interfaces:
    Serializable, UnivariateDifferentiableFunction, FieldUnivariateFunction, UnivariateFunction
    Direct Known Subclasses:
    SmoothStepFactory.QuadraticSmoothStepFunction
    Enclosing class:
    SmoothStepFactory

    public static class SmoothStepFactory.SmoothStepFunction
    extends PolynomialFunction
    Smoothstep function as defined here.

    It is used to do a smooth transition between the "left edge" and the "right edge" with left edge assumed to be smaller than right edge.

    By definition, for order n greater than 1 and input x, a smoothstep function respects at least the following properties :

    • f(x <= leftEdge) = 0 and f(x >= rightEdge) = 1
    • f'(leftEdge) = f'(rightEdge) = 0
    If x is normalized between edges, we have at least :
    • f(x <= 0) = 0 and f(x >= 1) = 1
    • f'(0) = f'(1) = 0
    Smoothstep functions of higher order n will have their higher time derivatives also equal to zero at edges...
    See Also:
    Serialized Form
    • Method Detail

      • value

        public double value​(double xNormalized)
        Compute the value of the smoothstep for the given argument normalized between edges.
        Specified by:
        value in interface UnivariateFunction
        Overrides:
        value in class PolynomialFunction
        Parameters:
        xNormalized - Normalized argument for which the function value should be computed. It is expected to be between [0:1] and will throw an exception otherwise.
        Returns:
        the value of the polynomial at the given point.
        See Also:
        UnivariateFunction.value(double)
      • value

        public double value​(double leftEdge,
                            double rightEdge,
                            double x)
                     throws MathIllegalArgumentException
        Compute the value of the smoothstep function for the given edges and argument.

        Note that right edge is expected to be greater than left edge. It will throw an exception otherwise.

        Parameters:
        leftEdge - left edge
        rightEdge - right edge
        x - Argument for which the function value should be computed
        Returns:
        the value of the polynomial at the given point
        Throws:
        MathIllegalArgumentException - if right edge is greater than left edge
        See Also:
        UnivariateFunction.value(double)
      • checkInputEdges

        protected void checkInputEdges​(double leftEdge,
                                       double rightEdge)
        Check that left edge is lower than right edge. Otherwise, throw an exception.
        Parameters:
        leftEdge - left edge
        rightEdge - right edge
      • clampInput

        protected double clampInput​(double leftEdge,
                                    double rightEdge,
                                    double x)
        Clamp input between edges.
        Parameters:
        leftEdge - left edge
        rightEdge - right edge
        x - input to clamp
        Returns:
        clamped input
      • normalizeInput

        protected double normalizeInput​(double leftEdge,
                                        double rightEdge,
                                        double x)
        Normalize input between left and right edges.
        Parameters:
        leftEdge - left edge
        rightEdge - right edge
        x - input to normalize
        Returns:
        normalized input