A surgical apparatus is provided including an endoscope, a camera, a light source, and a structured light pattern source. The endoscope includes an elongate body having a plurality of segments manipulatable relative to one another. The camera, light source, and structured light pattern source cooperate to determine the topography of a surface within a patient. A method of performing surgery is also provided.