RosettaCodeData/Task/Angles-geometric-normalizat.../00-TASK.txt

119 lines
5.0 KiB
Plaintext

This task is about the normalization and/or conversion of (geometric) angles using
some common scales.
The angular scales that will be used in this task are:
::*   degree
::*   gradian
::*   mil
::*   radian
;Definitions:
The angular scales used or referenced here:
::*   '''turn'''   is a full turn or 360 degrees, also shown as 360º
::* &nbsp; '''degree''' &nbsp; is &nbsp; <big>'''<sup>1</sup>/<sub>360</sub>'''</big> &nbsp; of a turn
::* &nbsp; '''gradian''' &nbsp; is &nbsp; <big>'''<sup>1</sup>/<sub>400</sub>'''</big> &nbsp; of a turn
::* &nbsp; '''mil''' &nbsp; is &nbsp; <big>'''<sup>1</sup>/<sub>6400</sub>'''</big> &nbsp; of a turn
::* &nbsp; '''radian''' &nbsp; is &nbsp; <big>'''<sup>1</sup>/<sub>2<big><big><math>\pi</math></big></big></sub></big>''' &nbsp; of a turn &nbsp; (or &nbsp; <big>'''<sup>0.5</sup>/<sub><big><big><math>\pi</math></big></big></sub>'''</big> &nbsp; of a turn)
Or, to put it another way, &nbsp; for a full circle:
::* &nbsp; there are &nbsp; '''360''' &nbsp; degrees
::* &nbsp; there are &nbsp; '''400''' &nbsp; gradians
::* &nbsp; there are &nbsp; '''6,400''' &nbsp; mils
::* &nbsp; there are &nbsp; '''2<big><big><math>\pi</math></big></big>''' &nbsp; radians &nbsp; (roughly equal to '''6.283<small>+</small>''')
A &nbsp; '''mil''' &nbsp; is approximately equal to a &nbsp; ''milliradian'' &nbsp; (which is &nbsp; <big>'''<sup>1</sup>/<sub>1000</sub>'''</big> &nbsp; of a radian).
There is another definition of a &nbsp; '''mil''' &nbsp; which
is &nbsp; '''<sup>1</sup>/<sub>1000</sub>''' &nbsp; of a radian &nbsp; ─── this
definition <u>won't</u> be used in this Rosetta Code task.
'''Turns''' &nbsp; are sometimes known or shown as:
:::* &nbsp; turn(s)
:::* &nbsp; 360 degrees
:::* &nbsp; unit circle
:::* &nbsp; a (full) circle
'''Degrees''' &nbsp; are sometimes known or shown as:
:::* &nbsp; degree(s)
:::* &nbsp; deg
:::* &nbsp; º &nbsp; &nbsp; &nbsp; (a symbol)
:::* &nbsp; ° &nbsp; &nbsp; &nbsp; (another symbol)
'''Gradians''' &nbsp; are sometimes known or shown as:
:::* &nbsp; gradian(s)
:::* &nbsp; grad(s)
:::* &nbsp; grade(s)
:::* &nbsp; gon(s)
:::* &nbsp; metric degree(s)
:::* &nbsp; (Note that &nbsp; '''centigrade''' &nbsp; was used for <sup>1</sup>/<sub>100</sub><sup>th</sup> of a grade, see the note below.)
'''Mils''' &nbsp; are sometimes known or shown as:
:::* &nbsp; mil(s)
:::* &nbsp; NATO mil(s)
'''Radians''' &nbsp; are sometimes known or shown as:
:::* &nbsp; radian(s)
:::* &nbsp; rad(s)
;Notes:
In continental Europe, the French term &nbsp; '''centigrade''' &nbsp; was used
for &nbsp; '''<sup>1</sup>/<sub>100</sub>''' &nbsp; of a grad (grade); &nbsp; this was
one reason for the adoption of the term &nbsp; '''Celsius''' &nbsp; to
replace &nbsp; '''centigrade''' &nbsp; as the name of a temperature scale.
Gradians were commonly used in civil engineering.
Mils were normally used for artillery &nbsp; (elevations of the gun barrel for ranging).
;Positive and negative angles:
Although the definition of the measurement of an angle doesn't support the
concept of a negative angle, &nbsp; it's frequently useful to impose a convention that
allows positive and negative angular values to represent orientations and/or rotations
in opposite directions relative to some reference. &nbsp; It is this reason that
negative angles will keep their sign and <u>not</u> be normalized to positive angles.
;Normalization:
Normalization &nbsp; (for this Rosetta Code task) &nbsp; will keep the same
sign, &nbsp; but it will reduce the magnitude to less than a full circle; &nbsp; in
other words, less than 360º.
Normalization &nbsp; <u>shouldn't</u> &nbsp; change &nbsp; '''-45º''' &nbsp; to &nbsp; '''315º''',
An angle of &nbsp; '''0º''', &nbsp; '''+0º''', &nbsp; '''0.000000''', &nbsp; or &nbsp; '''-0º''' &nbsp; should be
shown as &nbsp; '''0º'''.
;Task:
::* &nbsp; write a function (or equivalent) to do the normalization for each scale
:::::* Suggested names:
:::::* '''d2d''', &nbsp; '''g2g''', &nbsp; '''m2m''', &nbsp; and &nbsp;'''r2r'''
::* &nbsp; write a function (or equivalent) to convert one scale to another
:::::* Suggested names for comparison of different computer language function names:
:::::* '''d2g''', &nbsp; '''d2m''', &nbsp; and &nbsp; '''d2r''' &nbsp; for degrees
:::::* '''g2d''', &nbsp; '''g2m''', &nbsp; and &nbsp; '''g2r''' &nbsp; for gradians
:::::* '''m2d''', &nbsp; '''m2g''', &nbsp; and &nbsp; '''m2r''' &nbsp; for mils
:::::* '''r2d''', &nbsp; '''r2g''', &nbsp; and &nbsp; '''r2m''' &nbsp; for radians
::* &nbsp; normalize all angles used &nbsp; (except for the "original" or "base" angle)
::* &nbsp; show the angles in every scale and convert them to all other scales
::* &nbsp; show all output here on this page
For the (above) conversions, &nbsp; use these dozen numbers &nbsp; (in the order shown):
:* &nbsp; '''-2 &nbsp; -1 &nbsp; 0 &nbsp; 1 &nbsp; 2 &nbsp; 6.2831853 &nbsp; 16 &nbsp; 57.2957795 &nbsp; 359 &nbsp; 399 &nbsp; 6399 &nbsp; 1000000'''
<br><br>