Probably lots of ways....
but an old fashioned one is to actually to measure it with a tape.
Three Steps: 1- measure from water surface to top of toe rail.
2- run a suitably long tape measure end up with the main halyard shackle, AND tie a line also to the shackle in case the tape end comes loose. Measure down to toe rail.
3- estimate the remaining distance to the top of the vhf antenna and/or allow for the wind transducer. Often about 5 feet additional; enough to be safe.
Add up 1, 2, and 3 and you have a real world figure that should help prevent contact with bridge girders. Or, just use "42" since that's the answer to the meaning of life, the universe, and everything...