Three-way displacement sensor to measure the deformation