Limit cycles of small amplitude in polynomial and piecewise polynomial planar vector fields