A criterion for C^2-rectifiability of sets