The stadimeter does this for the periscope operatior. All he has to do is line up the periscope markings correctly, enter the "known" mast height from the recognition manual, and the stadimeter will instantly calculate the range.
The stadimeter was invented by an American naval officer, Bradley Allen Fiske, in 1800's, and was first used in naval gunnery trials in the mid 1890's. It was widely available by even the first world war
"
...In practice, a sailor would identify a distant ship, adjust the stadimeter for its mast-head height (a figure available in published accounts), bring the image of the mast-head into coincidence with the water line, and read the distance on the instrument’s drum. Stadimeters were widely used in World War I and again in World War II."
You might also find the 1946 Fleet Submarine Periscope manual interesting to read:
http://hnsa.org/doc/fleetsub/pscope/index.htm
P.S. When you look at US fleet boat scopes, the stadimeter control is a small crank below the right periscope handle, and the range readout dial is a large dial at the bottom of the scope, angles so it can be read by just glancing down from the eyepiece - see the pictures from
www.bowfin.org at
http://www.bowfin.org/website/bowfin.../periscope.htm
also -
http://hnsa.org/doc/attack/img/plateiv.jpg
P.P.S. Image through a u-boat periscope at
http://ww2wochenschau.com/ww2-video/...525-uboats.jpg
and
http://www.usmm.net/images/periscope.jpg