Confocal chromatic sensor with an actively tilted lens for 3D measurement