Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -17,7 +17,7 @@ F degrees2compasspoint(=d)
|
|||
R q[minorindex].replace(‘N’, p1).replace(‘E’, p2).capitalize()
|
||||
|
||||
:start:
|
||||
L(i) 33
|
||||
L(i) 0.<33
|
||||
V d = i * 11.25
|
||||
S i % 3
|
||||
1
|
||||
|
|
|
|||
|
|
@ -1,66 +0,0 @@
|
|||
with Ada.Text_IO;
|
||||
|
||||
procedure Box_The_Compass is
|
||||
|
||||
type Degrees is digits 5 range 0.00 .. 359.99;
|
||||
type Index_Type is mod 32;
|
||||
|
||||
function Long_Name(Short: String) return String is
|
||||
|
||||
function Char_To_Name(Char: Character) return String is
|
||||
begin
|
||||
case Char is
|
||||
when 'N' | 'n' => return Char & "orth";
|
||||
when 'S' | 's' => return Char & "outh";
|
||||
when 'E' | 'e' => return Char & "ast";
|
||||
when 'W' | 'w' => return Char & "est";
|
||||
when 'b' => return " by ";
|
||||
when '-' => return "-";
|
||||
when others => raise Constraint_Error;
|
||||
end case;
|
||||
end Char_To_Name;
|
||||
|
||||
begin
|
||||
if Short'Length = 0 or else Short(Short'First)=' ' then
|
||||
return "";
|
||||
else
|
||||
return Char_To_Name(Short(Short'First))
|
||||
& Long_Name(Short(Short'First+1 .. Short'Last));
|
||||
end if;
|
||||
end Long_Name;
|
||||
|
||||
procedure Put_Line(Angle: Degrees) is
|
||||
|
||||
function Index(D: Degrees) return Index_Type is
|
||||
begin
|
||||
return Index_Type(Integer(Degrees'Rounding(D/11.25)) mod 32);
|
||||
end Index;
|
||||
|
||||
I: Integer := Integer(Index(Angle))+1;
|
||||
package DIO is new Ada.Text_IO.Float_IO(Degrees);
|
||||
Abbr: constant array(Index_Type) of String(1 .. 4)
|
||||
:= ("N ", "Nbe ", "N-ne", "Nebn", "Ne ", "Nebe", "E-ne", "Ebn ",
|
||||
"E ", "Ebs ", "E-se", "Sebe", "Se ", "Sebs", "S-se", "Sbe ",
|
||||
"S ", "Sbw ", "S-sw", "Swbs", "Sw ", "Swbw", "W-sw", "Wbs ",
|
||||
"W ", "Wbn ", "W-nw", "Nwbw", "Nw ", "Nwbn", "N-nw", "Nbw ");
|
||||
|
||||
begin
|
||||
DIO.Put(Angle, Fore => 3, Aft => 2, Exp => 0); -- format "zzx.xx"
|
||||
Ada.Text_IO.Put(" |");
|
||||
if I <= 9 then
|
||||
Ada.Text_IO.Put(" ");
|
||||
end if;
|
||||
Ada.Text_IO.Put_Line(" " & Integer'Image(I) & " | "
|
||||
& Long_Name(Abbr(Index(Angle))));
|
||||
end Put_Line;
|
||||
|
||||
Difference: constant array(0..2) of Degrees'Base
|
||||
:= (0=> 0.0, 1=> +5.62, 2=> - 5.62);
|
||||
|
||||
begin
|
||||
Ada.Text_IO.Put_Line(" angle | box | compass point");
|
||||
Ada.Text_IO.Put_Line(" ---------------------------------");
|
||||
for I in 0 .. 32 loop
|
||||
Put_Line(Degrees(Degrees'Base(I) * 11.25 + Difference(I mod 3)));
|
||||
end loop;
|
||||
end Box_The_Compass;
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
Local $avArray[33] = [0.0, 16.87, 16.88, 33.75, 50.62, 50.63, 67.5, 84.37, 84.38, 101.25, 118.12, 118.13, 135.0, _
|
||||
151.87, 151.88, 168.75, 185.62, 185.63, 202.5, 219.37, 219.38, 236.25, 253.12, 253.13, 270.0, 286.87, 286.88, _
|
||||
303.75, 320.62, 320.63, 337.5, 354.37, 354.38]
|
||||
|
||||
For $i = 0 To UBound($avArray) - 1
|
||||
Boxing_the_compass($avArray[$i])
|
||||
Next
|
||||
|
||||
Func Boxing_the_compass($Degree)
|
||||
Local $namearray[33] = ["North", "North by east", "North-northeast", "Northeast by north", "Northeast", _
|
||||
"Northeast by east", "East-northeast", "East by north", "East", "East by south", "East-southeast", _
|
||||
"Southeast by east", "Southeast", "Southeast by south", "South-southeast", "South by east", "South", _
|
||||
"South by west", "South-southwest", "Southwest by south", "Southwest", "Southwest by west", "West-southwest", _
|
||||
"West by south", "West", "West by north", "West-northwest", "Northwest by west", "Northwest", "Northwest by north", _
|
||||
"North-northwest", "North by west", "North"]
|
||||
ConsoleWrite(StringFormat("%-2s", Mod(Floor($Degree / 11.25 + 0.5), 32)) & " : " & _
|
||||
StringFormat("%-20s", $namearray[Mod(Floor($Degree / 11.25 + 0.5), 32)]) & " : " & $Degree & @CRLF)
|
||||
EndFunc ;==>Boxing_the_compass
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
identification division.
|
||||
program-id. box-compass.
|
||||
data division.
|
||||
working-storage section.
|
||||
01 point pic 99.
|
||||
01 degrees usage float-short.
|
||||
01 degrees-rounded pic 999v99.
|
||||
01 show-degrees pic zz9.99.
|
||||
01 box pic z9.
|
||||
01 fudge pic 9.
|
||||
01 compass pic x(4).
|
||||
01 compass-point pic x(18).
|
||||
01 shortform pic x.
|
||||
01 short-names.
|
||||
05 short-name pic x(4) occurs 33 times.
|
||||
01 overlay.
|
||||
05 value "N " & "NbE " & "N-NE" & "NEbN" & "NE " &
|
||||
"NEbE" & "E-NE" & "EbN " & "E " & "EbS " &
|
||||
"E-SE" & "SEbE" & "SE " & "SEbS" & "S-SE" &
|
||||
"SbE " & "S " & "SbW " & "S-SW" & "SWbS" &
|
||||
"SW " & "SWbW" & "W-SW" & "WbS " & "W " &
|
||||
"WbN " & "W-NW" & "NWbW" & "NW " & "NWbN" &
|
||||
"N-NW" & "NbW " & "N ".
|
||||
|
||||
procedure division.
|
||||
display "Index Compass point Degree"
|
||||
|
||||
move overlay to short-names.
|
||||
perform varying point from 0 by 1 until point > 32
|
||||
compute box = function mod(point 32) + 1
|
||||
compute degrees = point * 11.25
|
||||
compute fudge = function mod(point 3)
|
||||
evaluate fudge
|
||||
when equal 1
|
||||
add 5.62 to degrees
|
||||
when equal 2
|
||||
subtract 5.62 from degrees
|
||||
end-evaluate
|
||||
|
||||
compute degrees-rounded rounded = degrees
|
||||
move degrees-rounded to show-degrees
|
||||
inspect show-degrees replacing trailing '00' by '0 '
|
||||
inspect show-degrees replacing trailing '50' by '5 '
|
||||
|
||||
move short-name(point + 1) to compass
|
||||
move spaces to compass-point
|
||||
display space box space space space with no advancing
|
||||
perform varying tally from 1 by 1 until tally > 4
|
||||
move compass(tally:1) to shortform
|
||||
move function concatenate(function trim(compass-point),
|
||||
function substitute(shortform,
|
||||
"N", "North",
|
||||
"E", "East",
|
||||
"S", "South",
|
||||
"W", "West",
|
||||
"b", " byZ",
|
||||
"-", "-"))
|
||||
to compass-point
|
||||
end-perform
|
||||
move function substitute(compass-point, "Z", " ")
|
||||
to compass-point
|
||||
move function lower-case(compass-point) to compass-point
|
||||
move function upper-case(compass-point(1:1))
|
||||
to compass-point(1:1)
|
||||
display compass-point space show-degrees
|
||||
end-perform
|
||||
goback.
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
constant names = {"North","North by east","North-northeast","Northeast by north",
|
||||
"Northeast","Northeast by east","East-northeast","East by north","East",
|
||||
"East by south","East-southeast","Southeast by east","Southeast","Southeast by south",
|
||||
"South-southeast","South by east","South","South by west","South-southwest",
|
||||
"Southwest by south","Southwest","Southwest by west","West-southwest",
|
||||
"West by south","West","West by north","West-northwest","Northwest by west",
|
||||
"Northwest","Northwest by north","North-northwest","North by west"}
|
||||
|
||||
function deg2ind(atom degree)
|
||||
return remainder(floor(degree*32/360+.5),32)+1
|
||||
end function
|
||||
|
||||
sequence degrees
|
||||
degrees = {}
|
||||
for i = 0 to 32 do
|
||||
degrees &= i*11.25 + 5.62*(remainder(i+1,3)-1)
|
||||
end for
|
||||
|
||||
integer j
|
||||
for i = 1 to length(degrees) do
|
||||
j = deg2ind(degrees[i])
|
||||
printf(1, "%6.2f %2d %-22s\n", {degrees[i], j, names[j]})
|
||||
end for
|
||||
|
|
@ -7,7 +7,7 @@ every heading := 11.25 * (i := 0 to 32) do {
|
|||
1: heading +:= 5.62
|
||||
2: heading -:= 5.62
|
||||
}
|
||||
write(right(i+1,3)," ",left(direction(heading),20)," ",fix(heading,,7,2))
|
||||
write(right(i%32+1,3)," ",left(direction(heading),20)," ",fix(heading,,7,2))
|
||||
}
|
||||
end
|
||||
|
||||
|
|
@ -17,10 +17,10 @@ initial {
|
|||
every put(dirs := [],
|
||||
replacem(!["N","NbE","N-NE","NEbN","NE","NEbE","E-NE","EbN",
|
||||
"E","EbS","E-SE","SEbE","SE","SEbS","S-SE","SbE",
|
||||
"S","SbW","S-SW","SWbS","SW","SWbW","W-SW","WbS",
|
||||
"W","WbN","W-NW","NWbW","NW","NWbN","N-NW","NbW"],
|
||||
"S","SbW","S-SW","SWbS","SW","SWbW","W-SW","WbS",
|
||||
"W","WbN","W-NW","NWbW","NW","NWbN","N-NW","NbW"],
|
||||
"N","north","E","east","W","west","S","south","b"," by "))
|
||||
}
|
||||
|
||||
return dirs[round(((((d%360)+360)%360)/11.25)%32 + 1)]
|
||||
return dirs[round(((((d%360)+360)%360)/11.25))%32 + 1]
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,48 +1,46 @@
|
|||
(phixonline)-->
|
||||
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span>
|
||||
<span style="color: #008080;">function</span> <span style="color: #000000;">get225</span><span style="color: #0000FF;">(</span><span style="color: #004080;">integer</span> <span style="color: #000000;">d</span><span style="color: #0000FF;">,</span> <span style="color: #004080;">string</span> <span style="color: #000000;">p1</span><span style="color: #0000FF;">,</span> <span style="color: #004080;">string</span> <span style="color: #000000;">p2</span><span style="color: #0000FF;">,</span> <span style="color: #004080;">string</span> <span style="color: #000000;">p4</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #004080;">string</span> <span style="color: #000000;">p3</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">p1</span><span style="color: #0000FF;">&</span><span style="color: #008000;">'-'</span><span style="color: #0000FF;">&</span><span style="color: #7060A8;">lower</span><span style="color: #0000FF;">(</span><span style="color: #000000;">p2</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #000000;">p2</span> <span style="color: #0000FF;">&=</span> <span style="color: #008000;">" by "</span><span style="color: #0000FF;">&</span><span style="color: #7060A8;">lower</span><span style="color: #0000FF;">(</span><span style="color: #000000;">p1</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #000000;">p1</span> <span style="color: #0000FF;">&=</span> <span style="color: #008000;">" by "</span><span style="color: #0000FF;">&</span><span style="color: #7060A8;">lower</span><span style="color: #0000FF;">(</span><span style="color: #000000;">p4</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #008080;">if</span> <span style="color: #000000;">d</span> <span style="color: #008080;">then</span>
|
||||
<span style="color: #008080;">return</span> <span style="color: #0000FF;">{</span><span style="color: #000000;">p1</span><span style="color: #0000FF;">,</span><span style="color: #000000;">p3</span><span style="color: #0000FF;">,</span><span style="color: #000000;">p2</span><span style="color: #0000FF;">}</span> <span style="color: #000080;font-style:italic;">-- eg {North by east,North-northeast,Northeast by north}</span>
|
||||
<span style="color: #008080;">else</span>
|
||||
<span style="color: #008080;">return</span> <span style="color: #0000FF;">{</span><span style="color: #000000;">p2</span><span style="color: #0000FF;">,</span><span style="color: #000000;">p3</span><span style="color: #0000FF;">,</span><span style="color: #000000;">p1</span><span style="color: #0000FF;">}</span> <span style="color: #000080;font-style:italic;">-- eg {Northeast by east,East-northeast,East by north}</span>
|
||||
<span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
|
||||
<span style="color: #008080;">end</span> <span style="color: #008080;">function</span>
|
||||
with javascript_semantics
|
||||
function get225(integer d, string p1, string p2, string p4)
|
||||
string p3 = p1&'-'&lower(p2)
|
||||
p2 &= " by "&lower(p1)
|
||||
p1 &= " by "&lower(p4)
|
||||
if d then
|
||||
return {p1,p3,p2} -- eg {North by east,North-northeast,Northeast by north}
|
||||
else
|
||||
return {p2,p3,p1} -- eg {Northeast by east,East-northeast,East by north}
|
||||
end if
|
||||
end function
|
||||
|
||||
<span style="color: #008080;">function</span> <span style="color: #000000;">get45</span><span style="color: #0000FF;">(</span><span style="color: #004080;">sequence</span> <span style="color: #000000;">res</span><span style="color: #0000FF;">,</span> <span style="color: #004080;">integer</span> <span style="color: #000000;">d</span><span style="color: #0000FF;">,</span> <span style="color: #004080;">string</span> <span style="color: #000000;">p1</span><span style="color: #0000FF;">,</span> <span style="color: #004080;">string</span> <span style="color: #000000;">p2</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #004080;">string</span> <span style="color: #000000;">p3</span>
|
||||
<span style="color: #000000;">res</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">append</span><span style="color: #0000FF;">(</span><span style="color: #000000;">res</span><span style="color: #0000FF;">,</span><span style="color: #000000;">p1</span><span style="color: #0000FF;">)</span> <span style="color: #000080;font-style:italic;">-- North/East/South/West</span>
|
||||
<span style="color: #008080;">if</span> <span style="color: #000000;">d</span> <span style="color: #008080;">then</span>
|
||||
<span style="color: #000000;">p3</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">p1</span><span style="color: #0000FF;">&</span><span style="color: #7060A8;">lower</span><span style="color: #0000FF;">(</span><span style="color: #000000;">p2</span><span style="color: #0000FF;">)</span> <span style="color: #000080;font-style:italic;">-- Northeast/Southwest</span>
|
||||
<span style="color: #008080;">else</span>
|
||||
<span style="color: #000000;">p3</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">p2</span><span style="color: #0000FF;">&</span><span style="color: #7060A8;">lower</span><span style="color: #0000FF;">(</span><span style="color: #000000;">p1</span><span style="color: #0000FF;">)</span> <span style="color: #000080;font-style:italic;">-- Southeast/Northwest</span>
|
||||
<span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
|
||||
<span style="color: #000000;">res</span> <span style="color: #0000FF;">&=</span> <span style="color: #000000;">get225</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #000000;">p1</span><span style="color: #0000FF;">,</span><span style="color: #000000;">p3</span><span style="color: #0000FF;">,</span><span style="color: #000000;">p2</span><span style="color: #0000FF;">)</span> <span style="color: #000080;font-style:italic;">-- eg get225(1,North,Northeast,East)
|
||||
-- -> {North by east,North-northeast,Northeast by north}</span>
|
||||
<span style="color: #000000;">res</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">append</span><span style="color: #0000FF;">(</span><span style="color: #000000;">res</span><span style="color: #0000FF;">,</span><span style="color: #000000;">p3</span><span style="color: #0000FF;">)</span> <span style="color: #000080;font-style:italic;">-- Northeast/Southeast/Southwest/Northwest</span>
|
||||
<span style="color: #000000;">res</span> <span style="color: #0000FF;">&=</span> <span style="color: #000000;">get225</span><span style="color: #0000FF;">(</span><span style="color: #000000;">0</span><span style="color: #0000FF;">,</span><span style="color: #000000;">p2</span><span style="color: #0000FF;">,</span><span style="color: #000000;">p3</span><span style="color: #0000FF;">,</span><span style="color: #000000;">p1</span><span style="color: #0000FF;">)</span> <span style="color: #000080;font-style:italic;">-- eg get225(0,East,Northeast,North)
|
||||
-- -> {Northeast by east,East-northeast,East by north}</span>
|
||||
<span style="color: #008080;">return</span> <span style="color: #000000;">res</span>
|
||||
<span style="color: #008080;">end</span> <span style="color: #008080;">function</span>
|
||||
function get45(sequence res, integer d, string p1, string p2)
|
||||
string p3
|
||||
res = append(res,p1) -- North/East/South/West
|
||||
if d then
|
||||
p3 = p1&lower(p2) -- Northeast/Southwest
|
||||
else
|
||||
p3 = p2&lower(p1) -- Southeast/Northwest
|
||||
end if
|
||||
res &= get225(1,p1,p3,p2) -- eg get225(1,North,Northeast,East)
|
||||
-- -> {North by east,North-northeast,Northeast by north}
|
||||
res = append(res,p3) -- Northeast/Southeast/Southwest/Northwest
|
||||
res &= get225(0,p2,p3,p1) -- eg get225(0,East,Northeast,North)
|
||||
-- -> {Northeast by east,East-northeast,East by north}
|
||||
return res
|
||||
end function
|
||||
|
||||
<span style="color: #008080;">function</span> <span style="color: #000000;">get90</span><span style="color: #0000FF;">(</span><span style="color: #004080;">sequence</span> <span style="color: #000000;">points</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #004080;">sequence</span> <span style="color: #000000;">res</span> <span style="color: #0000FF;">=</span> <span style="color: #0000FF;">{}</span>
|
||||
<span style="color: #008080;">for</span> <span style="color: #000000;">i</span><span style="color: #0000FF;">=</span><span style="color: #000000;">1</span> <span style="color: #008080;">to</span> <span style="color: #7060A8;">length</span><span style="color: #0000FF;">(</span><span style="color: #000000;">points</span><span style="color: #0000FF;">)</span> <span style="color: #008080;">do</span>
|
||||
<span style="color: #000000;">res</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">get45</span><span style="color: #0000FF;">(</span><span style="color: #000000;">res</span><span style="color: #0000FF;">,</span><span style="color: #7060A8;">remainder</span><span style="color: #0000FF;">(</span><span style="color: #000000;">i</span><span style="color: #0000FF;">,</span><span style="color: #000000;">2</span><span style="color: #0000FF;">),</span><span style="color: #000000;">points</span><span style="color: #0000FF;">[</span><span style="color: #000000;">i</span><span style="color: #0000FF;">],</span><span style="color: #000000;">points</span><span style="color: #0000FF;">[</span><span style="color: #7060A8;">remainder</span><span style="color: #0000FF;">(</span><span style="color: #000000;">i</span><span style="color: #0000FF;">,</span><span style="color: #000000;">4</span><span style="color: #0000FF;">)+</span><span style="color: #000000;">1</span><span style="color: #0000FF;">])</span>
|
||||
<span style="color: #008080;">end</span> <span style="color: #008080;">for</span> <span style="color: #000080;font-style:italic;">-- ie get45(1,North,East)
|
||||
-- get45(0,East,South)
|
||||
-- get45(1,South,West)
|
||||
-- get45(0,West,North)</span>
|
||||
<span style="color: #008080;">return</span> <span style="color: #000000;">res</span>
|
||||
<span style="color: #008080;">end</span> <span style="color: #008080;">function</span>
|
||||
function get90(sequence points)
|
||||
sequence res = {}
|
||||
for i=1 to length(points) do
|
||||
res = get45(res,remainder(i,2),points[i],points[remainder(i,4)+1])
|
||||
end for -- ie get45(1,North,East)
|
||||
-- get45(0,East,South)
|
||||
-- get45(1,South,West)
|
||||
-- get45(0,West,North)
|
||||
return res
|
||||
end function
|
||||
|
||||
<span style="color: #008080;">constant</span> <span style="color: #000000;">compass_points</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">get90</span><span style="color: #0000FF;">({</span><span style="color: #008000;">"North"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"East"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"South"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"West"</span><span style="color: #0000FF;">})</span>
|
||||
constant compass_points = get90({"North","East","South","West"})
|
||||
|
||||
<span style="color: #008080;">for</span> <span style="color: #000000;">i</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">1</span> <span style="color: #008080;">to</span> <span style="color: #000000;">33</span> <span style="color: #008080;">do</span>
|
||||
<span style="color: #004080;">atom</span> <span style="color: #000000;">test_point</span> <span style="color: #0000FF;">=</span> <span style="color: #0000FF;">(</span><span style="color: #000000;">i</span><span style="color: #0000FF;">-</span><span style="color: #000000;">1</span><span style="color: #0000FF;">)*</span><span style="color: #000000;">11.25</span> <span style="color: #0000FF;">+</span> <span style="color: #000000;">5.62</span><span style="color: #0000FF;">*(</span><span style="color: #7060A8;">remainder</span><span style="color: #0000FF;">(</span><span style="color: #000000;">i</span><span style="color: #0000FF;">,</span><span style="color: #000000;">3</span><span style="color: #0000FF;">)-</span><span style="color: #000000;">1</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #004080;">integer</span> <span style="color: #000000;">compass_point</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">remainder</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">floor</span><span style="color: #0000FF;">(</span><span style="color: #000000;">test_point</span><span style="color: #0000FF;">*</span><span style="color: #000000;">32</span><span style="color: #0000FF;">/</span><span style="color: #000000;">360</span><span style="color: #0000FF;">+</span><span style="color: #000000;">0.5</span><span style="color: #0000FF;">),</span><span style="color: #000000;">32</span><span style="color: #0000FF;">)+</span><span style="color: #000000;">1</span>
|
||||
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">"%2d %-22s %6.2f\n"</span><span style="color: #0000FF;">,</span> <span style="color: #0000FF;">{</span><span style="color: #000000;">compass_point</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">compass_points</span><span style="color: #0000FF;">[</span><span style="color: #000000;">compass_point</span><span style="color: #0000FF;">],</span> <span style="color: #000000;">test_point</span><span style="color: #0000FF;">})</span>
|
||||
<span style="color: #008080;">end</span> <span style="color: #008080;">for</span>
|
||||
<!--
|
||||
for i=1 to 33 do
|
||||
atom test_point = (i-1)*11.25 + 5.62*(remainder(i,3)-1)
|
||||
integer compass_point = remainder(floor(test_point*32/360+0.5),32)+1
|
||||
printf(1, "%2d %-22s %6.2f\n", {compass_point, compass_points[compass_point], test_point})
|
||||
end for
|
||||
|
|
|
|||
|
|
@ -1,18 +1,16 @@
|
|||
(phixonline)-->
|
||||
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span>
|
||||
<span style="color: #008080;">constant</span> <span style="color: #000000;">compass_points</span> <span style="color: #0000FF;">=</span> <span style="color: #0000FF;">{</span> <span style="color: #008000;">"North"</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">"North by east"</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">"North-northeast"</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">"Northeast by north"</span><span style="color: #0000FF;">,</span>
|
||||
<span style="color: #008000;">"Northeast"</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">"Northeast by east"</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">"East-northeast"</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">"East by north"</span><span style="color: #0000FF;">,</span>
|
||||
<span style="color: #008000;">"East"</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">"East by south"</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">"East-southeast"</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">"Southeast by east"</span><span style="color: #0000FF;">,</span>
|
||||
<span style="color: #008000;">"Southeast"</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">"Southeast by south"</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">"South-southeast"</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">"South by east"</span><span style="color: #0000FF;">,</span>
|
||||
<span style="color: #008000;">"South"</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">"South by west"</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">"South-southwest"</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">"Southwest by south"</span><span style="color: #0000FF;">,</span>
|
||||
<span style="color: #008000;">"Southwest"</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">"Southwest by west"</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">"West-southwest"</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">"West by south"</span><span style="color: #0000FF;">,</span>
|
||||
<span style="color: #008000;">"West"</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">"West by north"</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">"West-northwest"</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">"Northwest by west"</span><span style="color: #0000FF;">,</span>
|
||||
<span style="color: #008000;">"Northwest"</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">"Northwest by north"</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">"North-northwest"</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">"North by west"</span><span style="color: #0000FF;">},</span>
|
||||
<span style="color: #000000;">test_points</span> <span style="color: #0000FF;">=</span> <span style="color: #0000FF;">{</span> <span style="color: #000000;">0.0</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">16.87</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">16.88</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">33.75</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">50.62</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">50.63</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">67.5</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">84.37</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">84.38</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">101.25</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">118.12</span><span style="color: #0000FF;">,</span>
|
||||
<span style="color: #000000;">118.13</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">135.0</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">151.87</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">151.88</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">168.75</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">185.62</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">185.63</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">202.5</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">219.37</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">219.38</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">236.25</span><span style="color: #0000FF;">,</span>
|
||||
<span style="color: #000000;">253.12</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">253.13</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">270.0</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">286.87</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">286.88</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">303.75</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">320.62</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">320.63</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">337.5</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">354.37</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">354.38</span><span style="color: #0000FF;">}</span>
|
||||
<span style="color: #008080;">for</span> <span style="color: #000000;">i</span><span style="color: #0000FF;">=</span><span style="color: #000000;">1</span> <span style="color: #008080;">to</span> <span style="color: #7060A8;">length</span><span style="color: #0000FF;">(</span><span style="color: #000000;">test_points</span><span style="color: #0000FF;">)</span> <span style="color: #008080;">do</span>
|
||||
<span style="color: #004080;">integer</span> <span style="color: #000000;">compass_point</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">remainder</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">floor</span><span style="color: #0000FF;">(</span><span style="color: #000000;">test_points</span><span style="color: #0000FF;">[</span><span style="color: #000000;">i</span><span style="color: #0000FF;">]*</span><span style="color: #000000;">32</span><span style="color: #0000FF;">/</span><span style="color: #000000;">360</span><span style="color: #0000FF;">+</span><span style="color: #000000;">0.5</span><span style="color: #0000FF;">),</span><span style="color: #000000;">32</span><span style="color: #0000FF;">)+</span><span style="color: #000000;">1</span>
|
||||
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">"%2d %-22s %6.2f\n"</span><span style="color: #0000FF;">,</span> <span style="color: #0000FF;">{</span><span style="color: #000000;">compass_point</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">compass_points</span><span style="color: #0000FF;">[</span><span style="color: #000000;">compass_point</span><span style="color: #0000FF;">],</span> <span style="color: #000000;">test_points</span><span style="color: #0000FF;">[</span><span style="color: #000000;">i</span><span style="color: #0000FF;">]})</span>
|
||||
<span style="color: #008080;">end</span> <span style="color: #008080;">for</span>
|
||||
<!--
|
||||
with javascript_semantics
|
||||
constant compass_points = { "North", "North by east", "North-northeast", "Northeast by north",
|
||||
"Northeast", "Northeast by east", "East-northeast", "East by north",
|
||||
"East", "East by south", "East-southeast", "Southeast by east",
|
||||
"Southeast", "Southeast by south", "South-southeast", "South by east",
|
||||
"South", "South by west", "South-southwest", "Southwest by south",
|
||||
"Southwest", "Southwest by west", "West-southwest", "West by south",
|
||||
"West", "West by north", "West-northwest", "Northwest by west",
|
||||
"Northwest", "Northwest by north", "North-northwest", "North by west"},
|
||||
test_points = { 0.0, 16.87, 16.88, 33.75, 50.62, 50.63, 67.5, 84.37, 84.38, 101.25, 118.12,
|
||||
118.13, 135.0, 151.87, 151.88, 168.75, 185.62, 185.63, 202.5, 219.37, 219.38, 236.25,
|
||||
253.12, 253.13, 270.0, 286.87, 286.88, 303.75, 320.62, 320.63, 337.5, 354.37, 354.38}
|
||||
for t in test_points do
|
||||
integer compass_point = remainder(floor(t*32/360+0.5),32)+1
|
||||
printf(1, "%2d %-22s %6.2f\n", {compass_point, compass_points[compass_point], t})
|
||||
end for
|
||||
|
|
|
|||
|
|
@ -1,16 +0,0 @@
|
|||
function Convert-DegreeToDirection ( [double]$Degree )
|
||||
{
|
||||
|
||||
$Directions = @( 'n','n by e','n-ne','ne by n','ne','ne by e','e-ne','e by n',
|
||||
'e','e by s','e-se','se by e','se','se by s','s-se','s by e',
|
||||
's','s by w','s-sw','sw by s','sw','sw by w','w-sw','w by s',
|
||||
'w','w by n','w-nw','nw by w','nw','nw by n','n-nw','n by w',
|
||||
'n'
|
||||
).Replace( 's', 'south' ).Replace( 'e', 'east' ).Replace( 'n', 'north' ).Replace( 'w', 'west' )
|
||||
|
||||
$Directions[[math]::floor(( $Degree % 360 ) / 11.25 + 0.5 )]
|
||||
}
|
||||
|
||||
$x = 0.0, 16.87, 16.88, 33.75, 50.62, 50.63, 67.5, 84.37, 84.38, 101.25, 118.12, 118.13, 135.0, 151.87, 151.88, 168.75, 185.62, 185.63, 202.5, 219.37, 219.38, 236.25, 253.12, 253.13, 270.0, 286.87, 286.88, 303.75, 320.62, 320.63, 337.5, 354.37, 354.38
|
||||
|
||||
$x | % { Convert-DegreeToDirection -Degree $_ }
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
function Convert-DegreeToDirection ( [double]$Degree, [int]$Points )
|
||||
{
|
||||
|
||||
$Directions = @( 'n','n by e','n-ne','ne by n','ne','ne by e','e-ne','e by n',
|
||||
'e','e by s','e-se','se by e','se','se by s','s-se','s by e',
|
||||
's','s by w','s-sw','sw by s','sw','sw by w','w-sw','w by s',
|
||||
'w','w by n','w-nw','nw by w','nw','nw by n','n-nw','n by w',
|
||||
'n'
|
||||
).Replace( 's', 'south' ).Replace( 'e', 'east' ).Replace( 'n', 'north' ).Replace( 'w', 'west' )
|
||||
|
||||
$Directions[[math]::floor((( $Degree % 360 ) * $Points / 360 + 0.5 )) * 32 / $Points ]
|
||||
}
|
||||
|
||||
$x = 0.0, 16.87, 16.88, 33.75, 50.62, 50.63, 67.5, 84.37, 84.38, 101.25, 118.12, 118.13, 135.0, 151.87, 151.88, 168.75, 185.62, 185.63, 202.5, 219.37, 219.38, 236.25, 253.12, 253.13, 270.0, 286.87, 286.88, 303.75, 320.62, 320.63, 337.5, 354.37, 354.38
|
||||
|
||||
|
||||
$Values = @()
|
||||
ForEach ( $Degree in $X ) { $Values += [pscustomobject]@{ Degree = $Degree
|
||||
32 = ( Convert-DegreeToDirection -Degree $Degree -Points 32 )
|
||||
16 = ( Convert-DegreeToDirection -Degree $Degree -Points 16 )
|
||||
8 = ( Convert-DegreeToDirection -Degree $Degree -Points 8 )
|
||||
4 = ( Convert-DegreeToDirection -Degree $Degree -Points 4 ) } }
|
||||
$Values | Format-Table
|
||||
Loading…
Add table
Add a link
Reference in a new issue