A two-stage approximation strategy for piecewise smooth functions in two and three dimensions. (23rd September 2021)