Version 23 of Estimating Mountain Height Using Look Angles, Etcl Console Example

Updated 2011-06-15 14:26:21 by gold

Estimating Mountain Height Using Look Angles, Etcl Console Example

This page is under development. Comments are welcome, but please load any comments in the comments section at the middle of the page. Thanks,gold


gold Here is an eTCL script on estimating mountain height for the etcl console. I found an angle and baseline formula in an old precalculus book. The formula for mountain height was baseline*sin(aa)*sin(bb)/ sqrt( sin(aa)* sin(aa)-sin(bb)*sin(bb) ) The angles used are angles of elevation from the ends of the baseline. It stipulated that the baseline starting from point aa is perpendicular to the line of sight. The formula was not corrected for curvature of earth, which would be $corr = earth_radius * secant ((arclength)/earth_radius)-earth_radius. arclength is the arclength from the observer to the mountain.


In planning any software, there is a need to develop testcases. With back of envelope calculations, we can develop a number of peg points to check output of program.


 Testcases
quantityangleunitsangle unitsbaselineanswermethod
1.0 30 degrees 20degrees104.69textbook
2.0 56 degrees 67degrees500525nasawebsite
3.0 78 degrees 85degrees5001924nasawebsite
4.0 45 degrees 45degrees500288nasawebsite

Screenshots Section


http://img194.imageshack.us/img194/7241/image47.gif


Comments Section

Please place any comments here, Thanks.

Why do you utilize meaningless variable names in many of your procedures? I.e., aa, bb, cc as the inputs to mountain. Absent external explanations, aa, bb , cc have no meaning and therefore the names themselves do not help to guide a reader as to their meaning. Additionally, nom, denom have some meaning, numerator, denominator, but that meaning is self evident by being utilized in a division operation, so in the end, those names also convey zero additional meaning. Your example would be far easier to understand if you picked variable names that related to the real-world values that aa, bb, cc, nom, and denom actually represented.


gold Certainly a good suggestion. The old textbook used Greek letters alpha and beta, which are even more ivory tower thinking.


References:


Appendix TCL programs and scripts

* Pretty Print Version

        # Pretty print version from autoindent
        # and ased editor
        # written on Windows XP on eTCL
        # code from TCL WIKI, eTCL console script
        # 8jun2011, [gold]  
        console show 
        proc deg {} {return [ expr {1.*[pi]/180.}  ]}        
        proc degx {} {return [ expr {180./[pi]}  ]} 
        proc pi {} {expr 1.*acos(-1)}
        set counter 1
        proc mountain { aa bb cc } {
            global counter past
            set aa [ expr { [deg]*$aa*1. } ]
            set bb [ expr { [deg]*$bb*1. } ]
            set nom [ expr { $cc*sin($aa)*sin($bb)*1. } ]
            set denom [ expr { sin($aa)*sin($aa) -sin($bb)*sin($bb)  } ]
            set denom [ expr { abs($denom)*1.  } ]
            set denom [ expr { sqrt($denom)*1.  } ]            
            set xheight [ expr {1.* $nom/$denom } ]
            puts "$counter  $aa   $bb distance $cc moun $xheight  "
            incr counter
            wm title . "estimating mountain height"
        }
        mountain 30 20 10
        mountain 67 56 500
        mountain 85 78 500

Code scraps