summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2018-07-18 16:52:15 +0200
committernsensfel <SpamShield0@noot-noot.org>2018-07-18 16:52:15 +0200
commitae5a2d1329968bc05ff9e64e64758a04aafee624 (patch)
treed06a4b70f56f3e8946f6f9167a0494ddf2fe06f3 /src
parent2593eb197eb30079c6c74008b9b12d898a69ed95 (diff)
Still not satisfied with the noise function...
Diffstat (limited to 'src')
-rw-r--r--src/map-editor/src/Struct/Tile.elm16
1 files changed, 15 insertions, 1 deletions
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 =