Skip to content

Commit

Permalink
add encode
Browse files Browse the repository at this point in the history
  • Loading branch information
taisukef committed Dec 26, 2022
1 parent 4d00dd0 commit 19a9b8c
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions simple_geo3.laze
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
関数: 切り捨て(実数: 数) => (整数: 結果) {
整数: 整数部 = 数;
実数: 小数部 = 数 - 整数部;
結果 = 数 - 小数部;
}

関数: エンコード(実数: 緯度, 実数: 経度, 整数: レベル) => (文字列: Geo3x3) {
Geo3x3 = "E";
もし (経度 < 0.0) ならば {
Geo3x3 = "W";
経度 += 180.0;
}
緯度 += 90.0;
実数: 単位 = 180.0;
(整数: カウンタ = 1;) から (カウンタ == レベル) まで (カウンタ++;) {
単位 /= 3.0;
整数: 横 = 切り捨て(経度 / 単位);
整数: 縦 = 切り捨て(緯度 / 単位);
Geo3x3 += 横 + 縦 * 3 + 1;
経度 -= 横 * 単位;
緯度 -= 縦 * 単位;
}
}
関数: 実行() => (){
表示(エンコード(35.65858, 139.745433, 14));
}

0 comments on commit 19a9b8c

Please sign in to comment.