General approach to the envelope-function approximation based on a quadrature method.