Link | lp_math_DMStoDeg |
Author | Bil Corry |
Category | Math |
Version | 8.x |
License | Public Domain |
Posted | 20 Apr 2006 |
Updated | 20 Apr 2006 |
More by this author... |
Returns degrees given an angle in Degrees:Minutes:Seconds.
Requires [lp_decimal_precisionset]
(lp_math_DMStoDeg:'180:30:30');
Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.
[ define_tag:'lp_math_DMStoDeg', -description='Returns degrees given an angle in Degrees:Minutes:Seconds.', -priority='replace', -required='degrees', -optional='precision'; if: !(local_defined:'precision'); local:'precision' = 6; /if; // replace the delimiters with ours local:'deg' = (string_replaceregexp: (string:#degrees), -find='[^0-9]',-replace=' '); #deg = (string_replaceregexp: #deg, -find=' +',-replace=' '); #deg->trim; #deg = #deg->(split:' '); // get degrees, minutes, seconds local:'d' = 0; local:'m' = 0; local:'s' = 0; if: #deg->size == 1; #d = (decimal: #deg->(get:1)); else: #deg->size == 2; #d = (decimal: #deg->(get:1)); #m = (decimal: #deg->(get:2)); else: #deg->size == 3; #d = (decimal: #deg->(get:1)); #m = (decimal: #deg->(get:2)); #s = (decimal: #deg->(get:3)); /if; // return answer return: (lp_decimal_precisionset: #d + (#m / 60.0) + (#s / 3600.0), (integer:#precision)); /define_tag; ]
No comments
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft