/*
 * This file is part of libgim.
 *
 * libgim is free software: you can redistribute it and/or modify it under the
 * terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 * 
 * libgim is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with libgim.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Copyright 2012 Danny Robson <danny@nerdcruft.net>
 */

#include "lut.hpp"

const size_t util::noise::PERM[256] = {
    114, 247, 195, 115, 164, 64, 53, 51,
     82,  75, 244,  19, 255,  1, 43, 77,
    126, 141,  77,  23, 169,  7, 29, 72,
     92,  97,  69, 211, 218, 71, 47, 25,
    178,  10, 135, 139, 152, 38, 51, 90,
    206,  98, 130,  32, 192,  6,  2, 34,
     74,  50, 162, 111, 188,  7, 24, 27,
     22,  87,  49,  67, 202, 35, 22, 79,
    253, 197,  73,  94, 182, 39, 37, 51,
    121,  85,  17,  18, 109, 63, 48, 66,
    173, 245, 183, 201,  68, 21, 81, 70,
    200,   0, 191,  86,  52, 80, 29, 76,
     15, 180,  41,  58, 128,  2, 38, 33,
    132, 119,  60, 242,   6, 46,  7, 99,
    237, 108,  30,  93, 153, 12, 43, 16,
    163, 209, 219, 117,  83, 13, 26, 14,
     55, 159, 190,  81, 224, 78,  8, 76,
    118, 203,   8, 193, 248, 84, 13, 48,
    240,  38,  65, 227, 160,  9, 36, 36,
    122, 185,  33, 123, 158, 56, 47, 88,
    246, 215, 231, 131,   5, 24,  4, 25,
    230, 174, 189, 168, 241, 56, 31, 20,
    166, 186, 184, 155,  29, 42, 25,  0,
     35, 105, 221,  39, 216, 96, 28, 23,
     28,  61, 196, 101, 149, 13, 65, 16,
    175, 194,  44,  34, 187, 95, 99, 20,
     45, 112, 252,  11,  59, 26, 12, 17,
    171,  14,  70,  54, 142,  4, 67, 46,
      4, 127,  20, 133, 205, 54, 43,  3,
    110, 249, 172, 161, 140, 57, 40, 89,
      3, 150, 210, 232,  57, 45, 44, 54,
     91,  79, 250,  62,  37, 98, 36, 34,
};


const double util::noise::LUT[256] = {
    -0.8984982139196056,     0.4750710231804418,    -0.6519676730721629,     0.34818237268881935,
    -0.18205970986171605,    0.3451314956848195,     0.6414228668402755,    -0.804052019344714,
     0.6838765435328942,     0.04489123586160382,    0.9387123107757223,    -0.8286734231526627,
    -0.5752448478162355,    -0.7177473684716851,     0.9935836223400552,     0.7280624253259176,
     0.17859563727209138,   -0.03606344150253982,   -0.15882231678491388,    0.4578698195539206,
    -0.4154225972126202,    -0.5194028373429245,     0.24561279025507043,   -0.8817931383760225,
     0.051621615744299465,  -0.432105334458762,      0.1565615530978024,     0.6597775199873575,
     0.22566777177285857,   -0.30483300012361036,   -0.6958206141316641,    -0.2930693331180243,
    -0.7690503602769119,    -0.7171818210252867,     0.8800261811087657,     0.8601395971416754,
     0.5784335763333026,     0.060900655607116994,   0.2837112260220951,    -0.08799217109739876,
    -0.2384174709999518,    -0.770742115936714,      0.9217986500940929,     0.33319037162928433,
     0.2338527159073147,     0.9326260912305022,    -0.3277100775267676,    -0.6923414380512052,
     0.2743829582530313,     0.021903777340825714,  -0.99594589251304,       0.08310122202568193,
     0.031989194381878194,   0.322274671882117,      0.15855440115773267,    0.7221472232498565,
    -0.5369740081438523,    -0.013966337693399833,  -0.3797229432191469,    -0.1449216443374528,
     0.4780175549902941,     0.3253792901693007,     0.8302471035699828,    -0.19705446486920075,
    -0.05145564508096312,    0.07804387053425987,   -0.43766576462644347,   -0.6841198355261591,
     0.7137706240638149,    -0.05484055085953887,   -0.8299960004843008,     0.18050577055894035,
    -0.8541390034524383,    -0.26341201926055424,    0.7023808019022437,     0.6230332593788754,
    -0.2959807962046559,     0.8971411582261257,    -0.37285148660593714,   -0.9689413803647513,
     0.36271555405510414,   -0.2369795401687047,    -0.057686227499222476,   0.45924926449705117,
     0.5909634897508582,    -0.8641968475739907,    -0.9868274716835026,     0.15367421531182823,
     0.47868338795465704,    0.22205133716275216,    0.9342712841005696,     0.574755268557622,
    -0.30781440722062237,    0.08940264916288165,   -0.7364035085406784,    -0.42804724032315544,
    -0.3028896080136707,     0.08043452763728154,    0.35597931924492854,    0.8218045295996388,
    -0.2639539020450863,     0.14018881766976743,   -0.9679978866175825,     0.917534812674309,
     0.8315532029453319,    -0.26657576198722377,    0.5292911314793278,     0.05106195480414244,
    -0.20703582048726044,    0.9363562930545231,     0.07180492189859389,   -0.9307494388376307,
     0.48401747690392316,   -0.47666025737165385,   -0.2995451643535043,     0.9645238474628381,
    -0.9869506025182451,    -0.6267193760632264,     0.9417871950627361,    -0.3712682888227079,
     0.17116236816682484,    0.1637861802304843,     0.5979849303287379,    -0.7943555560703199,
    -0.8605593297161265,     0.24271029593235993,    0.8838806440116482,     0.6563769551024692,
     0.9357703879808301,    -0.76818344297623,       0.7661179391954425,     0.426530438580041,
    -0.7280736750184795,     0.5258880971264928,    -0.3736324615581794,    -0.3726200928816683,
    -0.652698944621871,      0.1312826210242899,     0.022999070967927526,   0.8362192026388207,
    -0.20524579974666657,   -0.39989736807434273,    0.097666397673847,      0.25215779272486416,
    -0.6800982672863105,     0.8013507802109068,     0.969941009294419,     -0.2760313084806676,
     0.8961286070268608,     0.9455740223217473,    -0.3908254141167051,     0.8195441725353367,
    -0.571435969794009,      0.18987091511038434,   -0.04181589713692069,   -0.963609489444007,
    -0.5281459088656999,     0.984266295584705,      0.5027560371807003,    -0.1597738785923013,
     0.3411131481434917,     0.12429799530598684,   -0.5159001480993852,     0.8865722840594523,
     0.32969200413777755,    0.26288894768315707,   -0.054978081511632526,  -0.37725903459638177,
     0.18451775548204163,   -0.6691455193869638,     0.9285268978526233,    -0.49526622636914563,
    -0.12647685137552322,   -0.08438978664878105,   -0.4263493078967011,     0.04134592579064478,
     0.5682513712371484,     0.3144579798890128,    -0.5560826395168046,    -0.7651643315076799,
    -0.4919051361482554,     0.4326849315222068,     0.9745607803884215,     0.5459754840343867,
    -0.3314574932052319,     0.10102331343981996,   -0.8762141515646111,    -0.8182536989519216,
     0.5460251598764976,     0.11958795888450968,   -0.7226482729866581,    -0.5362654501182944,
     0.9461689136255056,     0.7302075935427872,     0.2067222384707743,    -0.5515294144965857,
     0.5261119777013636,    -0.6058524684579083,    -0.7984088236296627,     0.5515069318003252,
     0.6842126925238694,     0.9653367596972298,    -0.4209547631571078,    -0.200564767100335,
    -0.45471383032946067,   -0.5407480745656619,     0.7853038244196648,     0.08741550867662506,
     0.46188948442462063,    0.32857850460858384,    0.2519455394025394,    -0.5647397901411311,
    -0.8010538532270075,     0.03511555124942123,    0.8126644809142252,    -0.6165437893290324,
    -0.769144309230668,      0.5811756737759881,     0.04347549540355833,   -0.1516485473331033,
    -0.8025604153817143,     0.2078203269944925,    -0.8281743083984969,    -0.5483796887270644,
    -0.67075976237068,       0.08046291156170216,   -0.726116057042915,      0.6064692851498683,
    -0.2326853771750068,    -0.1199137086641211,    -0.007902895438233637,  -0.024018850623878762,
     0.23518281506286076,    0.8739589142046267,     0.9461972684232018,    -0.6298769685383707,
    -0.37298229425868623,   -0.0443367550367304,    -0.9688376819157003,     0.09999263734937558,
    -0.3975824040014859,     0.3353645267506893,    -0.2693845909559329,    -0.1133673242389015,
    -0.8453467042866694,     0.5313565920953589,    -0.5313028936659494,     0.23266080060836347,
     0.19579971665018436,    0.9392643282850877,     0.08508300565389537,   -0.43964224026992116,
     0.5862798492854766,     0.7001806971895554,     0.9050597336377173,    -0.5789943930802939,
};