An Analytical Solution to the Perspective-n-Point Problem for Common Planar Camera and for Catadioptric Sensor