A metric approach to plasticity via Hamilton-Jacobi equation