Polytopic planar region characterization of rough terrains for legged locomotion