From ae5a2d1329968bc05ff9e64e64758a04aafee624 Mon Sep 17 00:00:00 2001 From: nsensfel Date: Wed, 18 Jul 2018 16:52:15 +0200 Subject: Still not satisfied with the noise function... --- src/map-editor/src/Struct/Tile.elm | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/map-editor') diff --git a/src/map-editor/src/Struct/Tile.elm b/src/map-editor/src/Struct/Tile.elm index aaf6eab..9ad944e 100644 --- a/src/map-editor/src/Struct/Tile.elm +++ b/src/map-editor/src/Struct/Tile.elm @@ -69,7 +69,21 @@ type alias Instance = -------------------------------------------------------------------------------- noise_function : Int -> Int -> Int -> Int noise_function a b c = - (round (radians (toFloat ((a + 1) * 2 + (b + 1) * 3 + c)))) + let + af = (toFloat a) + bf = (toFloat b) + cf = (toFloat c) + (df, ef) = (toPolar (af, bf)) + (ff, gf) = (toPolar (bf, af)) + (hf, jf) = (toPolar (bf, cf)) + (kf, lf) = (toPolar (cf, bf)) + (mf, nf) = (toPolar (af, cf)) + (qf, rf) = (toPolar (cf, af)) + (resA, resB) = (fromPolar ((df + qf), (ef + nf))) + (resC, resD) = (fromPolar ((hf + mf), (jf + gf))) + (resE, resF) = (toPolar ((resA - resC), (resB - resD))) + in + (round (resE - resF)) finish_decoding : PartiallyDecoded -> Type finish_decoding add_tile = -- cgit v1.2.3-70-g09d2