June 2018 Update

This commit is contained in:
Ingy döt Net 2018-06-22 20:57:24 +00:00
parent ba8067c3b7
commit 22f33d4004
5278 changed files with 84726 additions and 14379 deletions

View file

@ -1,18 +1,15 @@
# v0.6
function degree2compasspoint(d::Float64)::String
const MAJORS = ("north", "east", "south", "ovest", "north", "east", "south", "ovest")
const QUART1 = ("N", "N by E", "N-NE", "NE by N", "NE", "NE by E", "E-NE", "E by N")
const QUART2 = tuple((replace(p, "NE", "EN") for p in QUART1)...)
majors = ("north", "east", "south", "ovest", "north", "east", "south", "ovest")
quart1 = ("N", "N by E", "N-NE", "NE by N", "NE", "NE by E", "E-NE", "E by N")
d = (d % 360) + 360/64
majorindex, minor = divrem(d, 90)
minorindex = div(minor * 4, 45)
majorindex += 1
minorindex += 1
p1, p2 = MAJORS[majorindex:majorindex+1]
if p1 in ("north", "south"); q = QUART1
else q = QUART1 end
p1, p2 = majors[majorindex:majorindex+1]
if p1 in ("north", "south"); q = quart1
else q = quart1 end
return titlecase(replace(replace(q[minorindex], 'N', p1), 'E', p2))
end