According to intensity consideration along the propagation axis, we derived mathematical conditions for a family of modulating functions able to produce needles of arbitrary length, sub-wavelength width and almost constant irradiance. These functions are derived by introducing mathematical constrains on the on-axis power content. As a result, the modulating distribution is continuous with no jumps within or at the edge of the pupil. Numerical results suggests that the proposed approach is suitable for producing high quality needles.