SHARE
TWEET

ArduboyLUTs (float)

ulfben Mar 8th, 2020 (edited) 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. constexpr float tan_table[768] PROGMEM {
  2.         0.000818f,0.009000f,0.017182f,0.025367f,0.033556f,0.041749f,0.049947f,0.058152f,0.066365f,0.074587f,0.082819f,0.091062f,0.099318f,0.107586f,0.115870f,0.124169f,0.132485f,0.140819f,0.149172f,0.157546f,0.165941f,0.174359f,0.182802f,0.191269f,0.199763f,0.208285f,0.216836f,0.225417f,0.234030f,0.242676f,0.251357f,0.260073f,0.268826f,0.277618f,0.286450f,0.295324f,0.304240f,0.313201f,0.322208f,0.331263f,0.340367f,0.349522f,0.358729f,0.367990f,0.377308f,0.386683f,0.396117f,0.405613f,0.415172f,0.424797f,0.434488f,0.444249f,0.454081f,0.463986f,0.473966f,0.484025f,0.494163f,0.504384f,0.514689f,0.525081f,0.535564f,0.546138f,0.556807f,0.567574f,0.578442f,0.589412f,0.600490f,0.611676f,0.622975f,0.634390f,0.645924f,0.657580f,0.669363f,0.681275f,0.693321f,0.705504f,0.717829f,0.730299f,0.742920f,0.755694f,0.768628f,0.781725f,0.794991f,0.808430f,0.822049f,0.835852f,0.849845f,0.864034f,0.878425f,0.893024f,0.907838f,0.922875f,0.938139f,0.953640f,0.969385f,0.985381f,1.001638f,1.018163f,1.034966f,1.052055f,1.069441f,1.087135f,1.105146f,1.123485f,1.142165f,1.161198f,1.180595f,1.200370f,1.220538f,1.241113f,1.262110f,1.283545f,1.305436f,1.327798f,1.350652f,1.374017f,1.397913f,1.422361f,1.447386f,1.473010f,1.499260f,1.526161f,1.553743f,1.582035f,1.611068f,1.640878f,1.671499f,1.702969f,1.735328f,1.768619f,1.802888f,1.838183f,1.874556f,1.912062f,1.950760f,1.990713f,2.031989f,2.074660f,2.118805f,2.164509f,2.211859f,2.260955f,2.311902f,2.364813f,2.419811f,2.477031f,2.536620f,2.598733f,2.663545f,2.731244f,2.802038f,2.876154f,2.953842f,3.035379f,3.121068f,3.211248f,3.306294f,3.406625f,3.512709f,3.625071f,3.744301f,3.871069f,4.006128f,4.150340f,4.304689f,4.470307f,4.648500f,4.840782f,5.048926f,5.275003f,5.521475f,5.791267f,6.087897f,6.415625f,6.779663f,7.186462f,7.644079f,8.162753f,8.755661f,9.440068f,10.239041f,11.184112f,12.319571f,13.709556f,15.450745f,17.695831f,20.701040f,24.931747f,31.330647f,42.140896f,64.327286f,135.811066f,-1222.229004f,-111.115623f,-58.199440f,-39.420891f,-29.801161f,-23.952900f,-20.021200f,-17.196249f,-15.068141f,-13.407147f,-12.074522f,-10.981501f,-10.068707f,-9.294851f,-8.630375f,-8.053544f,-7.548029f,-7.101317f,-6.703656f,-6.347353f,-6.026228f,-5.735280f,-5.470413f,-5.228238f,-5.005932f,-4.801115f,-4.611784f,-4.436220f,-4.272954f,-4.120718f,-3.978411f,-3.845076f,-3.719873f,-3.602067f,-3.491006f,-3.386113f,-3.286875f,-3.192834f,-3.103581f,-3.018749f,-2.938005f,-2.861053f,-2.787620f,-2.717463f,-2.650357f,-2.586099f,-2.524505f,-2.465402f,-2.408638f,-2.354067f,-2.301558f,-2.250991f,-2.202252f,-2.155239f,-2.109855f,-2.066011f,-2.023625f,-1.982619f,-1.942921f,-1.904467f,-1.867192f,-1.831040f,-1.795954f,-1.761885f,-1.728783f,-1.696605f,-1.665308f,-1.634852f,-1.605201f,-1.576318f,-1.548171f,-1.520727f,-1.493958f,-1.467836f,-1.442334f,-1.417427f,-1.393090f,-1.369302f,-1.346041f,-1.323287f,-1.301020f,-1.279222f,-1.257877f,-1.236965f,-1.216473f,-1.196384f,-1.176685f,-1.157362f,-1.138401f,-1.119791f,-1.101518f,-1.083571f,-1.065940f,-1.048614f,-1.031582f,-1.014836f,-0.998365f,-0.982161f,-0.966216f,-0.950521f,-0.935067f,-0.919849f,-0.904858f,-0.890088f,-0.875530f,-0.861180f,-0.847031f,-0.833076f,-0.819311f,-0.805728f,-0.792324f,-0.779092f,-0.766028f,-0.753127f,-0.740383f,-0.727793f,-0.715352f,-0.703056f,-0.690901f,-0.678882f,-0.666996f,-0.655239f,-0.643607f,-0.632097f,-0.620706f,-0.609430f,-0.598266f,-0.587210f,-0.576260f,-0.565413f,-0.554666f,-0.544016f,-0.533460f,-0.522996f,-0.512621f,-0.502333f,-0.492129f,-0.482007f,-0.471964f,-0.461999f,-0.452109f,-0.442291f,-0.432545f,-0.422867f,-0.413255f,-0.403709f,-0.394226f,-0.384803f,-0.375440f,-0.366134f,-0.356883f,-0.347686f,-0.338542f,-0.329448f,-0.320403f,-0.311405f,-0.302454f,-0.293546f,-0.284681f,-0.275857f,-0.267072f,-0.258327f,-0.249618f,-0.240944f,-0.232305f,-0.223698f,-0.215123f,-0.206578f,-0.198062f,-0.189573f,-0.181111f,-0.172674f,-0.164260f,-0.155870f,-0.147500f,-0.139151f,-0.130820f,-0.122508f,-0.114212f,-0.105931f,-0.097665f,-0.089413f,-0.081172f,-0.072942f,-0.064722f,-0.056511f,-0.048307f,-0.040110f,-0.031918f,-0.023730f,-0.015546f,-0.007363f,0.000818f,0.009000f,0.017182f,0.025367f,0.033556f,0.041749f,0.049947f,0.058152f,0.066365f,0.074587f,0.082819f,0.091062f,0.099318f,0.107586f,0.115870f,0.124169f,0.132485f,0.140819f,0.149172f,0.157546f,0.165941f,0.174359f,0.182802f,0.191269f,0.199763f,0.208285f,0.216836f,0.225417f,0.234030f,0.242676f,0.251357f,0.260073f,0.268826f,0.277618f,0.286450f,0.295324f,0.304240f,0.313201f,0.322208f,0.331263f,0.340367f,0.349522f,0.358729f,0.367990f,0.377308f,0.386683f,0.396117f,0.405613f,0.415172f,0.424797f,0.434488f,0.444249f,0.454081f,0.463986f,0.473966f,0.484024f,0.494163f,0.504384f,0.514689f,0.525081f,0.535563f,0.546138f,0.556807f,0.567574f,0.578442f,0.589412f,0.600490f,0.611676f,0.622975f,0.634390f,0.645924f,0.657580f,0.669363f,0.681275f,0.693321f,0.705504f,0.717829f,0.730299f,0.742919f,0.755694f,0.768628f,0.781725f,0.794991f,0.808430f,0.822049f,0.835852f,0.849845f,0.864034f,0.878425f,0.893024f,0.907838f,0.922874f,0.938139f,0.953640f,0.969385f,0.985381f,1.001638f,1.018162f,1.034965f,1.052055f,1.069441f,1.087135f,1.105146f,1.123485f,1.142165f,1.161197f,1.180596f,1.200371f,1.220539f,1.241114f,1.262111f,1.283546f,1.305435f,1.327799f,1.350653f,1.374017f,1.397914f,1.422362f,1.447386f,1.473010f,1.499261f,1.526162f,1.553743f,1.582036f,1.611070f,1.640879f,1.671499f,1.702970f,1.735329f,1.768620f,1.802890f,1.838184f,1.874557f,1.912062f,1.950761f,1.990714f,2.031989f,2.074663f,2.118807f,2.164509f,2.211859f,2.260957f,2.311903f,2.364813f,2.419814f,2.477034f,2.536620f,2.598733f,2.663547f,2.731246f,2.802039f,2.876158f,2.953846f,3.035380f,3.121068f,3.211252f,3.306297f,3.406626f,3.512715f,3.625075f,3.744304f,3.871069f,4.006133f,4.150343f,4.304691f,4.470317f,4.648508f,4.840787f,5.048925f,5.275013f,5.521481f,5.791270f,6.087914f,6.415638f,6.779672f,7.186460f,7.644099f,8.162767f,8.755669f,9.440108f,10.239076f,11.184137f,12.319566f,13.709618f,15.450793f,17.695860f,20.701231f,24.931952f,31.330849f,42.140839f,64.328629f,135.814880f,-1222.098511f,-111.110130f,-58.198334f,-39.420570f,-29.801189f,-23.952713f,-20.021118f,-17.196224f,-15.068040f,-13.407088f,-12.074492f,-10.981504f,-10.068673f,-9.294833f,-8.630368f,-8.053514f,-7.548010f,-7.101306f,-6.703658f,-6.347339f,-6.026220f,-5.735277f,-5.470399f,-5.228229f,-5.005926f,-4.801116f,-4.611776f,-4.436216f,-4.272952f,-4.120709f,-3.978405f,-3.845073f,-3.719874f,-3.602063f,-3.491003f,-3.386112f,-3.286870f,-3.192831f,-3.103579f,-3.018748f,-2.938002f,-2.861051f,-2.787619f,-2.717459f,-2.650354f,-2.586098f,-2.524504f,-2.465400f,-2.408636f,-2.354066f,-2.301556f,-2.250989f,-2.202251f,-2.155238f,-2.109852f,-2.066009f,-2.023623f,-1.982616f,-1.942920f,-1.904466f,-1.867192f,-1.831038f,-1.795953f,-1.761883f,-1.728783f,-1.696603f,-1.665307f,-1.634852f,-1.605199f,-1.576317f,-1.548170f,-1.520727f,-1.493957f,-1.467835f,-1.442333f,-1.417425f,-1.393089f,-1.369301f,-1.346041f,-1.323286f,-1.301019f,-1.279222f,-1.257875f,-1.236964f,-1.216472f,-1.196384f,-1.176684f,-1.157362f,-1.138401f,-1.119789f,-1.101517f,-1.083571f,-1.065940f,-1.048613f,-1.031582f,-1.014835f,-0.998364f,-0.982161f,-0.966216f,-0.950521f,-0.935067f,-0.919849f,-0.904858f,-0.890087f,-0.875530f,-0.861180f,-0.847031f,-0.833076f,-0.819310f,-0.805728f,-0.792323f,-0.779092f,-0.766028f,-0.753127f,-0.740383f,-0.727793f,-0.715352f,-0.703056f,-0.690900f,-0.678882f,-0.666996f,-0.655238f,-0.643607f,-0.632097f,-0.620705f,-0.609429f,-0.598265f,-0.587210f,-0.576259f,-0.565412f,-0.554665f,-0.544015f,-0.533459f,-0.522995f,-0.512621f,-0.502332f,-0.492128f,-0.482006f,-0.471963f,-0.461998f,-0.452108f,-0.442291f,-0.432544f,-0.422866f,-0.413255f,-0.403708f,-0.394225f,-0.384803f,-0.375440f,-0.366133f,-0.356883f,-0.347686f,-0.338542f,-0.329448f,-0.320403f,-0.311405f,-0.302453f,-0.293545f,-0.284680f,-0.275856f,-0.267072f,-0.258326f,-0.249618f,-0.240944f,-0.232305f,-0.223698f,-0.215123f,-0.206578f,-0.198062f,-0.189573f,-0.181111f,-0.172674f,-0.164260f,-0.155869f,-0.147500f,-0.139150f,-0.130820f,-0.122507f,-0.114212f,-0.105931f,-0.097665f,-0.089412f,-0.081172f,-0.072942f,-0.064721f,-0.056510f,-0.048307f,-0.040109f,-0.031917f,-0.023730f,-0.015545f,-0.007363f};
  3. constexpr float y_step[768] PROGMEM {
  4.         0.052360f,0.575974f,1.099666f,1.623504f,2.147560f,2.671904f,3.196607f,3.721738f,4.247370f,4.773572f,5.300416f,5.827976f,6.356322f,6.885528f,7.415666f,7.946809f,8.479033f,9.012412f,9.547022f,10.082937f,10.620236f,11.158998f,11.699297f,12.241216f,12.784832f,13.330229f,13.877487f,14.426691f,14.977924f,15.531273f,16.086823f,16.644661f,17.204882f,17.767570f,18.332819f,18.900724f,19.471380f,20.044886f,20.621336f,21.200836f,21.783482f,22.369385f,22.958649f,23.551380f,24.147692f,24.747694f,25.351509f,25.959248f,26.571033f,27.186991f,27.807243f,28.431923f,29.061157f,29.695086f,30.333843f,30.977577f,31.626431f,32.280548f,32.940090f,33.605206f,34.276066f,34.952824f,35.635662f,36.324749f,37.020264f,37.722393f,38.431332f,39.147266f,39.870403f,40.600948f,41.339119f,42.085133f,42.839211f,43.601604f,44.372536f,45.152264f,45.941044f,46.739151f,47.546848f,48.364422f,49.192169f,50.030396f,50.879410f,51.739540f,52.611134f,53.494518f,54.390072f,55.298164f,56.219196f,57.153553f,58.101662f,59.063969f,60.040913f,61.032967f,62.040627f,63.064400f,64.104813f,65.162415f,66.237793f,67.331528f,68.444252f,69.576630f,70.729332f,71.903061f,73.098572f,74.316643f,75.558067f,76.823708f,78.114456f,79.431252f,80.775055f,82.146904f,83.547874f,84.979088f,86.441734f,87.937065f,89.466408f,91.031136f,92.632698f,94.272652f,95.952621f,97.674309f,99.439537f,101.250214f,103.108383f,105.016220f,106.975945f,108.990013f,111.060997f,113.191635f,115.384834f,117.643707f,119.971596f,122.371956f,124.848618f,127.405609f,130.047272f,132.778259f,135.603546f,138.528564f,141.559006f,144.701141f,147.961716f,151.348007f,154.867920f,158.530014f,162.343674f,166.318909f,170.466858f,174.799622f,179.330429f,184.073868f,189.045898f,194.264282f,199.748383f,205.519867f,211.602814f,218.024002f,224.813370f,232.004532f,239.635269f,247.748428f,256.392181f,265.621735f,275.500092f,286.099670f,297.503998f,309.810059f,323.131287f,337.600220f,353.374390f,370.641113f,389.625427f,410.599976f,433.898407f,459.933563f,489.221069f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,483.073853f,454.484283f,429.033997f,406.230560f,385.678589f,367.057922f,350.106415f,334.607239f,320.379639f,307.271362f,295.154144f,283.918091f,273.469055f,263.725922f,254.618301f,246.084885f,238.071884f,230.532303f,223.424393f,216.711227f,210.359985f,204.341385f,198.629211f,193.199936f,188.032318f,183.107361f,178.407684f,173.917603f,169.622833f,165.510361f,161.568298f,157.785736f,154.152802f,150.660278f,147.299728f,144.063416f,140.944153f,137.935287f,135.030746f,132.224686f,129.511993f,126.887589f,124.346962f,121.885910f,119.500305f,117.186562f,114.941048f,112.760635f,110.642120f,108.582703f,106.579735f,104.630554f,102.732880f,100.884346f,99.082947f,97.326553f,95.613327f,93.941528f,92.309357f,90.715302f,89.157745f,87.635345f,86.146629f,84.690346f,83.265297f,81.870232f,80.504097f,79.165764f,77.854279f,76.568604f,75.307854f,74.071182f,72.857681f,71.666603f,70.497124f,69.348564f,68.220161f,67.111267f,66.021263f,64.949478f,63.895378f,62.858326f,61.837837f,60.833324f,59.844318f,58.870354f,57.910915f,56.965603f,56.033932f,55.115540f,54.209972f,53.316868f,52.435883f,51.566605f,50.708736f,49.861893f,49.025803f,48.200104f,47.384518f,46.578773f,45.782547f,44.995609f,44.217648f,43.448456f,42.687740f,41.935280f,41.190868f,40.454231f,39.725197f,39.003506f,38.288998f,37.581432f,36.880650f,36.186424f,35.498596f,34.816998f,34.141422f,33.471737f,32.807739f,32.149307f,31.496244f,30.848419f,30.205704f,29.567915f,28.934946f,28.306625f,27.682852f,27.063461f,26.448341f,25.837385f,25.230433f,24.627401f,24.028137f,23.432560f,22.840523f,22.251934f,21.666700f,21.084684f,20.505812f,19.929951f,19.357035f,18.786928f,18.219555f,17.654833f,17.092640f,16.532913f,15.975532f,15.420439f,14.867514f,14.316686f,13.767887f,13.221001f,12.675976f,12.132698f,11.591119f,11.051126f,10.512658f,9.975651f,9.439995f,8.905646f,8.372498f,7.840505f,7.309561f,6.779609f,6.250590f,5.722401f,5.194999f,4.668282f,4.142208f,3.616676f,3.091629f,2.567013f,2.042726f,1.518727f,0.994917f,0.471255f,-0.052359f,-0.575979f,-1.099662f,-1.623507f,-2.147555f,-2.671906f,-3.196599f,-3.721737f,-4.247375f,-4.773568f,-5.300420f,-5.827971f,-6.356323f,-6.885520f,-7.415664f,-7.946815f,-8.479030f,-9.012416f,-9.547016f,-10.082939f,-10.620230f,-11.158997f,-11.699303f,-12.241212f,-12.784836f,-13.330223f,-13.877489f,-14.426683f,-14.977923f,-15.531279f,-16.086819f,-16.644665f,-17.204874f,-17.767570f,-18.332811f,-18.900723f,-19.471386f,-20.044882f,-20.621340f,-21.200829f,-21.783484f,-22.369377f,-22.958647f,-23.551386f,-24.147688f,-24.747700f,-25.351501f,-25.959249f,-26.571024f,-27.186989f,-27.807249f,-28.431917f,-29.061161f,-29.695078f,-30.333847f,-30.977568f,-31.626427f,-32.280556f,-32.940083f,-33.605209f,-34.276058f,-34.952827f,-35.635654f,-36.324749f,-37.020271f,-37.722393f,-38.431335f,-39.147259f,-39.870403f,-40.600941f,-41.339119f,-42.085117f,-42.839211f,-43.601604f,-44.372528f,-45.152267f,-45.941036f,-46.739147f,-47.546833f,-48.364418f,-49.192177f,-50.030388f,-50.879414f,-51.739532f,-52.611130f,-53.494503f,-54.390068f,-55.298176f,-56.219185f,-57.153557f,-58.101650f,-59.063965f,-60.040894f,-61.032963f,-62.040634f,-63.064388f,-64.104813f,-65.162399f,-66.237785f,-67.331505f,-68.444252f,-69.576637f,-70.729317f,-71.903069f,-73.098557f,-74.316635f,-75.558121f,-76.823746f,-78.114471f,-79.431320f,-80.775101f,-82.146927f,-83.547867f,-84.979141f,-86.441765f,-87.937080f,-89.466484f,-91.031181f,-92.632729f,-94.272659f,-95.952690f,-97.674355f,-99.439552f,-101.250313f,-103.108459f,-105.016235f,-106.975937f,-108.990097f,-111.061050f,-113.191658f,-115.384956f,-117.643799f,-119.971619f,-122.371948f,-124.848717f,-127.405678f,-130.047302f,-132.778412f,-135.603668f,-138.528595f,-141.558990f,-144.701263f,-147.961792f,-151.348038f,-154.868118f,-158.530167f,-162.343704f,-166.318893f,-170.467026f,-174.799728f,-179.330490f,-184.074127f,-189.046112f,-194.264343f,-199.748352f,-205.520111f,-211.602982f,-218.024063f,-224.813751f,-232.004822f,-239.635468f,-247.748398f,-256.392517f,-265.621979f,-275.500214f,-286.100281f,-297.504486f,-309.810394f,-323.131226f,-337.600830f,-353.374786f,-370.641296f,-389.626495f,-410.600861f,-433.899017f,-459.933472f,-489.222321f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-483.072632f,-454.483612f,-429.034088f,-406.229706f,-385.678070f,-367.057739f,-350.105530f,-334.606659f,-320.379272f,-307.271423f,-295.153687f,-283.917816f,-273.468933f,-263.725403f,-254.617950f,-246.084686f,-238.071915f,-230.532013f,-223.424210f,-216.711151f,-210.359650f,-204.341156f,-198.629074f,-193.199890f,-188.032120f,-183.107239f,-178.407639f,-173.917358f,-169.622665f,-165.510254f,-161.568253f,-157.785583f,-154.152710f,-150.660233f,-147.299561f,-144.063293f,-140.944061f,-137.935257f,-135.030548f,-132.224579f,-129.511887f,-126.887405f,-124.346855f,-121.885811f,-119.500282f,-117.186401f,-114.940964f,-112.760544f,-110.642097f,-108.582619f,-106.579651f,-104.630531f,-102.732750f,-100.884277f,-99.082870f,-97.326530f,-95.613258f,-93.941460f,-92.309341f,-90.715195f,-89.157684f,-87.635284f,-86.146614f,-84.690292f,-83.265244f,-81.870216f,-80.504005f,-79.165710f,-77.854225f,-76.568588f,-75.307808f,-74.071136f,-72.857666f,-71.666527f,-70.497078f,-69.348518f,-68.220146f,-67.111221f,-66.021225f,-64.949471f,-63.895306f,-62.858284f,-61.837795f,-60.833313f,-59.844276f,-58.870316f,-57.910904f,-56.965538f,-56.033894f,-55.115501f,-54.209961f,-53.316833f,-52.435848f,-51.566597f,-50.708679f,-49.861862f,-49.025772f,-48.200096f,-47.384483f,-46.578743f,-45.782539f,-44.995556f,-44.217617f,-43.448425f,-42.687733f,-41.935249f,-41.190838f,-40.454224f,-39.725147f,-39.003479f,-38.288971f,-37.581425f,-36.880604f,-36.186398f,-35.498589f,-34.816952f,-34.141396f,-33.471710f,-32.807732f,-32.149261f,-31.496218f,-30.848413f,-30.205660f,-29.567888f,-28.934921f,-28.306618f,-27.682810f,-27.063437f,-26.448334f,-25.837341f,-25.230408f,-24.627377f,-24.028130f,-23.432518f,-22.840500f,-22.251928f,-21.666660f,-21.084661f,-20.505789f,-19.929945f,-19.356995f,-18.786905f,-18.219547f,-17.654795f,-17.092617f,-16.532890f,-15.975526f,-15.420401f,-14.867492f,-14.316680f,-13.767849f,-13.220979f,-12.675954f,-12.132692f,-11.591082f,-11.051105f,-10.512652f,-9.975614f,-9.439974f,-8.905625f,-8.372492f,-7.840468f,-7.309540f,-6.779603f,-6.250554f,-5.722380f,-5.194978f,-4.668276f,-4.142171f,-3.616655f,-3.091624f,-2.566977f,-2.042705f,-1.518706f,-0.994911f,-0.471219f};
  5. constexpr float x_step[768] PROGMEM {
  6.         512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,483.073975f,454.484314f,429.034302f,406.230835f,385.678802f,367.058075f,350.106506f,334.607300f,320.379639f,307.271545f,295.154297f,283.918182f,273.469147f,263.725983f,254.618332f,246.084915f,238.071960f,230.532364f,223.424454f,216.711273f,210.360016f,204.341400f,198.629227f,193.199921f,188.032379f,183.107407f,178.407715f,173.917618f,169.622833f,165.510376f,161.568298f,157.785782f,154.152832f,150.660294f,147.299744f,144.063416f,140.944153f,137.935287f,135.030701f,132.224670f,129.511932f,126.887558f,124.346954f,121.885880f,119.500298f,117.186523f,114.941040f,112.760590f,110.642105f,108.582718f,106.579704f,104.630547f,102.732849f,100.884346f,99.082909f,97.326530f,95.613342f,93.941498f,92.309349f,90.715271f,89.157745f,87.635307f,86.146614f,84.690353f,83.265282f,81.870232f,80.504082f,79.165756f,77.854240f,76.568596f,75.307861f,74.071175f,72.857674f,71.666588f,70.497124f,69.348541f,68.220146f,67.111275f,66.021255f,64.949478f,63.895359f,62.858322f,61.837811f,60.833313f,59.844322f,58.870342f,57.910912f,56.965588f,56.033928f,55.115513f,54.209961f,53.316875f,52.435875f,51.566605f,50.708725f,49.861893f,49.025784f,48.200092f,47.384518f,46.578766f,45.782547f,44.995594f,44.217648f,43.448444f,42.687733f,41.935284f,41.190861f,40.454235f,39.725189f,39.003498f,38.288982f,37.581425f,36.880634f,36.186420f,35.498600f,34.816994f,34.141415f,33.471722f,32.807732f,32.149292f,31.496239f,30.848423f,30.205700f,29.567909f,28.934931f,28.306618f,27.682837f,27.063456f,26.448343f,25.837379f,25.230425f,24.627386f,24.028131f,23.432545f,22.840519f,22.251936f,21.666697f,21.084679f,20.505798f,19.929947f,19.357021f,18.786922f,18.219557f,17.654827f,17.092642f,16.532900f,15.975526f,15.420424f,14.867509f,14.316689f,13.767882f,13.221004f,12.675962f,12.132693f,11.591106f,11.051122f,10.512661f,9.975646f,9.439998f,8.905634f,8.372493f,7.840492f,7.309556f,6.779612f,6.250585f,5.722404f,5.194986f,4.668277f,4.142195f,3.616671f,3.091632f,2.567008f,2.042728f,1.518715f,0.994912f,0.471243f,-0.052363f,-0.575977f,-1.099667f,-1.623505f,-2.147567f,-2.671910f,-3.196612f,-3.721742f,-4.247372f,-4.773573f,-5.300417f,-5.827983f,-6.356328f,-6.885532f,-7.415668f,-7.946812f,-8.479034f,-9.012413f,-9.547029f,-10.082944f,-10.620242f,-11.159001f,-11.699300f,-12.241218f,-12.784832f,-13.330236f,-13.877495f,-14.426696f,-14.977929f,-15.531276f,-16.086824f,-16.644663f,-17.204887f,-17.767574f,-18.332823f,-18.900728f,-19.471384f,-20.044888f,-20.621338f,-21.200834f,-21.783489f,-22.369390f,-22.958652f,-23.551382f,-24.147692f,-24.747696f,-25.351507f,-25.959253f,-26.571039f,-27.186993f,-27.807247f,-28.431923f,-29.061155f,-29.695084f,-30.333832f,-30.977573f,-31.626415f,-32.280540f,-32.940090f,-33.605198f,-34.276062f,-34.952812f,-35.635658f,-36.324734f,-37.020260f,-37.722397f,-38.431320f,-39.147266f,-39.870392f,-40.600948f,-41.339100f,-42.085125f,-42.839218f,-43.601589f,-44.372532f,-45.152252f,-45.941044f,-46.739132f,-47.546841f,-48.364426f,-49.192162f,-50.030396f,-50.879398f,-51.739536f,-52.611111f,-53.494511f,-54.390076f,-55.298161f,-56.219193f,-57.153538f,-58.101662f,-59.063950f,-60.040901f,-61.032970f,-62.040619f,-63.064404f,-64.104790f,-65.162407f,-66.237762f,-67.331520f,-68.444260f,-69.576614f,-70.729324f,-71.903038f,-73.098564f,-74.316612f,-75.558052f,-76.823715f,-78.114449f,-79.431252f,-80.775032f,-82.146904f,-83.547844f,-84.979073f,-86.441734f,-87.937050f,-89.466408f,-91.031105f,-92.632698f,-94.272629f,-95.952606f,-97.674324f,-99.439514f,-101.250221f,-103.108360f,-105.016205f,-106.975899f,-108.989990f,-111.060951f,-113.191620f,-115.384842f,-117.643684f,-119.971573f,-122.371902f,-124.848587f,-127.405548f,-130.047256f,-132.778275f,-135.603531f,-138.528534f,-141.558929f,-144.701111f,-147.961639f,-151.347977f,-154.867935f,-158.529968f,-162.343628f,-166.318802f,-170.466812f,-174.799515f,-179.330399f,-184.073883f,-189.045853f,-194.264236f,-199.748245f,-205.519821f,-211.602661f,-218.023941f,-224.813400f,-232.004456f,-239.635300f,-247.748230f,-256.392090f,-265.621490f,-275.500000f,-286.099731f,-297.503906f,-309.810120f,-323.130951f,-337.600098f,-353.373993f,-370.640961f,-389.625519f,-410.599792f,-433.898529f,-459.932922f,-489.220795f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-512.000000f,-483.074158f,-454.484131f,-429.034576f,-406.230743f,-385.679047f,-367.058105f,-350.106323f,-334.607391f,-320.379547f,-307.271667f,-295.154266f,-283.918335f,-273.469147f,-263.725861f,-254.618393f,-246.084854f,-238.072067f,-230.532364f,-223.424545f,-216.711288f,-210.359955f,-204.341446f,-198.629196f,-193.199997f,-188.032364f,-183.107468f,-178.407730f,-173.917572f,-169.622864f,-165.510330f,-161.568344f,-157.785767f,-154.152878f,-150.660309f,-147.299713f,-144.063446f,-140.944122f,-137.935318f,-135.030685f,-132.224716f,-129.511948f,-126.887527f,-124.346985f,-121.885864f,-119.500320f,-117.186516f,-114.941063f,-112.760590f,-110.642082f,-108.582718f,-106.579697f,-104.630569f,-102.732849f,-100.884361f,-99.082909f,-97.326569f,-95.613342f,-93.941498f,-92.309364f,-90.715263f,-89.157761f,-87.635315f,-86.146645f,-84.690361f,-83.265274f,-81.870239f,-80.504074f,-79.165771f,-77.854248f,-76.568611f,-75.307869f,-74.071159f,-72.857689f,-71.666580f,-70.497139f,-69.348541f,-68.220169f,-67.111275f,-66.021248f,-64.949493f,-63.895359f,-62.858337f,-61.837818f,-60.833336f,-59.844322f,-58.870335f,-57.910923f,-56.965580f,-56.033939f,-55.115520f,-54.209923f,-53.316849f,-52.435867f,-51.566563f,-50.708694f,-49.861877f,-49.025787f,-48.200062f,-47.384502f,-46.578758f,-45.782509f,-44.995571f,-44.217632f,-43.448441f,-42.687702f,-41.935265f,-41.190853f,-40.454197f,-39.725159f,-39.003494f,-38.288986f,-37.581394f,-36.880615f,-36.186413f,-35.498562f,-34.816963f,-34.141407f,-33.471722f,-32.807705f,-32.149273f,-31.496231f,-30.848389f,-30.205673f,-29.567904f,-28.934935f,-28.306595f,-27.682823f,-27.063450f,-26.448311f,-25.837355f,-25.230421f,-24.627388f,-24.028107f,-23.432531f,-22.840511f,-22.251905f,-21.666672f,-21.084673f,-20.505802f,-19.929922f,-19.357006f,-18.786917f,-18.219526f,-17.654806f,-17.092628f,-16.532902f,-15.975505f,-15.420411f,-14.867502f,-14.316658f,-13.767859f,-13.220989f,-12.675964f,-12.132671f,-11.591093f,-11.051116f,-10.512632f,-9.975624f,-9.439984f,-8.905636f,-8.372472f,-7.840478f,-7.309550f,-6.779583f,-6.250564f,-5.722390f,-5.194988f,-4.668256f,-4.142182f,-3.616665f,-3.091604f,-2.566987f,-2.042715f,-1.518717f,-0.994891f,-0.471230f,0.052369f,0.576005f,1.099688f,1.623518f,2.147565f,2.671931f,3.196625f,3.721747f,4.247400f,4.773594f,5.300430f,5.827981f,6.356349f,6.885546f,7.415674f,7.946841f,8.479056f,9.012426f,9.547027f,10.082965f,10.620256f,11.159007f,11.699329f,12.241239f,12.784847f,13.330235f,13.877516f,14.426710f,14.977936f,15.531306f,16.086847f,16.644676f,17.204885f,17.767597f,18.332838f,18.900734f,19.471415f,20.044910f,20.621351f,21.200840f,21.783512f,22.369406f,22.958658f,23.551416f,24.147717f,24.747711f,25.351515f,25.959280f,26.571054f,27.187002f,27.807280f,28.431948f,29.061174f,29.695091f,30.333878f,30.977598f,31.626440f,32.280586f,32.940117f,33.605225f,34.276070f,34.952862f,35.635685f,36.324764f,37.020267f,37.722427f,38.431351f,39.147274f,39.870441f,40.600975f,41.339134f,42.085133f,42.839249f,43.601624f,44.372540f,45.152302f,45.941078f,46.739166f,47.546848f,48.364456f,49.192192f,50.030403f,50.879456f,51.739571f,52.611145f,53.494522f,54.390110f,55.298195f,56.219204f,57.153599f,58.101700f,59.063988f,60.040916f,61.033012f,62.040653f,63.064411f,64.104866f,65.162453f,66.237808f,67.331528f,68.444305f,69.576660f,70.729340f,71.903122f,73.098618f,74.316658f,75.558067f,76.823769f,78.114502f,79.431267f,80.775124f,82.146950f,83.547897f,84.979080f,86.441803f,87.937111f,89.466423f,91.031212f,92.632759f,94.272690f,95.952621f,97.674393f,99.439590f,101.250244f,103.108490f,105.016273f,106.975975f,108.990013f,111.061089f,113.191704f,115.384872f,117.643845f,119.971664f,122.371994f,124.848618f,127.405724f,130.047363f,132.778305f,135.603729f,138.528656f,141.559052f,144.701141f,147.961853f,151.348114f,154.867981f,158.530243f,162.343796f,166.318970f,170.466873f,174.799820f,179.330582f,184.073929f,189.046204f,194.264435f,199.748474f,205.519882f,211.603104f,218.024200f,224.813492f,232.004959f,239.635620f,247.748581f,256.392181f,265.622162f,275.500397f,286.099854f,297.504730f,309.810638f,323.131500f,337.600250f,353.375122f,370.641663f,389.625732f,410.601318f,433.899506f,459.934021f,489.221130f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f,512.000000f};
  7. constexpr float inv_sin_table[960] PROGMEM {
  8.         1222.310059f,111.120583f,58.208103f,39.433578f,29.818027f,23.973820f,20.046188f,17.225317f,15.101295f,13.444393f,12.115861f,11.026951f,10.118253f,9.348496f,8.688120f,8.115394f,7.613985f,7.171381f,6.777837f,6.425647f,6.108638f,5.821809f,5.561064f,5.323015f,5.104836f,4.904155f,4.718959f,4.547534f,4.388410f,4.240321f,4.102165f,3.972985f,3.851943f,3.738301f,3.631409f,3.530689f,3.435629f,3.345772f,3.260708f,3.180070f,3.103527f,3.030780f,2.961558f,2.895618f,2.832736f,2.772708f,2.715349f,2.660491f,2.607975f,2.557661f,2.509417f,2.463120f,2.418660f,2.375932f,2.334842f,2.295300f,2.257222f,2.220535f,2.185164f,2.151045f,2.118114f,2.086314f,2.055590f,2.025891f,1.997171f,1.969383f,1.942485f,1.916440f,1.891208f,1.866756f,1.843049f,1.820058f,1.797752f,1.776103f,1.755086f,1.734675f,1.714847f,1.695579f,1.676850f,1.658640f,1.640931f,1.623703f,1.606939f,1.590623f,1.574740f,1.559274f,1.544211f,1.529538f,1.515242f,1.501310f,1.487730f,1.474492f,1.461584f,1.448996f,1.436719f,1.424743f,1.413058f,1.401657f,1.390530f,1.379670f,1.369070f,1.358721f,1.348617f,1.338751f,1.329117f,1.319709f,1.310519f,1.301544f,1.292776f,1.284211f,1.275844f,1.267669f,1.259682f,1.251878f,1.244254f,1.236804f,1.229524f,1.222411f,1.215460f,1.208669f,1.202033f,1.195549f,1.189214f,1.183025f,1.176978f,1.171070f,1.165299f,1.159662f,1.154156f,1.148778f,1.143527f,1.138399f,1.133393f,1.128505f,1.123735f,1.119079f,1.114536f,1.110104f,1.105780f,1.101564f,1.097453f,1.093445f,1.089539f,1.085733f,1.082026f,1.078416f,1.074902f,1.071482f,1.068155f,1.064920f,1.061775f,1.058719f,1.055751f,1.052870f,1.050075f,1.047365f,1.044738f,1.042194f,1.039732f,1.037351f,1.035050f,1.032827f,1.030684f,1.028618f,1.026628f,1.024715f,1.022877f,1.021114f,1.019426f,1.017810f,1.016268f,1.014799f,1.013401f,1.012075f,1.010820f,1.009635f,1.008521f,1.007476f,1.006501f,1.005595f,1.004758f,1.003989f,1.003289f,1.002657f,1.002092f,1.001595f,1.001166f,1.000804f,1.000509f,1.000282f,1.000121f,1.000027f,1.000000f,1.000041f,1.000148f,1.000322f,1.000563f,1.000871f,1.001247f,1.001689f,1.002200f,1.002778f,1.003424f,1.004138f,1.004920f,1.005771f,1.006691f,1.007679f,1.008738f,1.009866f,1.011065f,1.012334f,1.013675f,1.015087f,1.016571f,1.018128f,1.019758f,1.021461f,1.023239f,1.025092f,1.027020f,1.029025f,1.031106f,1.033266f,1.035504f,1.037821f,1.040218f,1.042697f,1.045257f,1.047900f,1.050628f,1.053440f,1.056338f,1.059323f,1.062397f,1.065559f,1.068813f,1.072158f,1.075597f,1.079130f,1.082759f,1.086486f,1.090312f,1.094238f,1.098266f,1.102399f,1.106636f,1.110981f,1.115436f,1.120001f,1.124680f,1.129473f,1.134385f,1.139415f,1.144567f,1.149844f,1.155247f,1.160779f,1.166442f,1.172240f,1.178176f,1.184251f,1.190469f,1.196834f,1.203348f,1.210015f,1.216838f,1.223820f,1.230966f,1.238280f,1.245764f,1.253425f,1.261265f,1.269289f,1.277501f,1.285908f,1.294513f,1.303322f,1.312340f,1.321573f,1.331026f,1.340706f,1.350619f,1.360771f,1.371169f,1.381821f,1.392733f,1.403915f,1.415372f,1.427114f,1.439150f,1.451489f,1.464140f,1.477113f,1.490418f,1.504067f,1.518072f,1.532442f,1.547192f,1.562335f,1.577883f,1.593851f,1.610255f,1.627110f,1.644433f,1.662242f,1.680554f,1.699389f,1.718767f,1.738710f,1.759240f,1.780381f,1.802160f,1.824601f,1.847733f,1.871586f,1.896191f,1.921583f,1.947795f,1.974868f,2.002838f,2.031751f,2.061651f,2.092586f,2.124608f,2.157771f,2.192136f,2.227764f,2.264724f,2.303088f,2.342933f,2.384344f,2.427410f,2.472229f,2.518905f,2.567554f,2.618299f,2.671270f,2.726616f,2.784494f,2.845078f,2.908554f,2.975133f,3.045039f,3.118522f,3.195860f,3.277355f,3.363348f,3.454210f,3.550364f,3.652277f,3.760469f,3.875538f,3.998144f,4.129049f,4.269109f,4.419314f,4.580792f,4.754844f,4.942993f,5.146999f,5.368951f,5.611293f,5.876967f,6.169482f,6.493089f,6.853017f,7.255693f,7.709207f,8.223765f,8.812576f,9.492890f,10.287749f,11.228735f,12.360060f,13.745964f,15.483025f,17.724041f,20.725197f,24.951750f,31.346645f,42.152412f,64.334740f,135.811157f,-1222.342285f,-111.119591f,-58.208286f,-39.433506f,-29.818108f,-23.973808f,-20.046238f,-17.225323f,-15.101278f,-13.444403f,-12.115854f,-11.026961f,-10.118251f,-9.348507f,-8.688122f,-8.115388f,-7.613987f,-7.171379f,-6.777841f,-6.425645f,-6.108642f,-5.821809f,-5.561061f,-5.323016f,-5.104835f,-4.904156f,-4.718958f,-4.547536f,-4.388411f,-4.240319f,-4.102166f,-3.972985f,-3.851945f,-3.738301f,-3.631410f,-3.530689f,-3.435628f,-3.345773f,-3.260708f,-3.180071f,-3.103527f,-3.030781f,-2.961559f,-2.895617f,-2.832736f,-2.772708f,-2.715350f,-2.660491f,-2.607976f,-2.557662f,-2.509416f,-2.463120f,-2.418660f,-2.375933f,-2.334842f,-2.295300f,-2.257223f,-2.220535f,-2.185164f,-2.151045f,-2.118114f,-2.086314f,-2.055590f,-2.025891f,-1.997170f,-1.969383f,-1.942485f,-1.916440f,-1.891208f,-1.866756f,-1.843050f,-1.820058f,-1.797752f,-1.776103f,-1.755086f,-1.734675f,-1.714847f,-1.695579f,-1.676850f,-1.658640f,-1.640930f,-1.623703f,-1.606939f,-1.590623f,-1.574740f,-1.559274f,-1.544211f,-1.529538f,-1.515242f,-1.501310f,-1.487730f,-1.474492f,-1.461584f,-1.448996f,-1.436719f,-1.424743f,-1.413058f,-1.401657f,-1.390530f,-1.379670f,-1.369070f,-1.358721f,-1.348617f,-1.338751f,-1.329118f,-1.319709f,-1.310519f,-1.301543f,-1.292776f,-1.284211f,-1.275843f,-1.267669f,-1.259682f,-1.251878f,-1.244253f,-1.236803f,-1.229524f,-1.222410f,-1.215460f,-1.208669f,-1.202033f,-1.195549f,-1.189214f,-1.183024f,-1.176977f,-1.171070f,-1.165299f,-1.159662f,-1.154156f,-1.148778f,-1.143527f,-1.138399f,-1.133393f,-1.128505f,-1.123735f,-1.119079f,-1.114536f,-1.110104f,-1.105780f,-1.101564f,-1.097453f,-1.093445f,-1.089539f,-1.085733f,-1.082026f,-1.078416f,-1.074902f,-1.071482f,-1.068155f,-1.064919f,-1.061775f,-1.058719f,-1.055751f,-1.052870f,-1.050075f,-1.047365f,-1.044738f,-1.042194f,-1.039732f,-1.037351f,-1.035050f,-1.032827f,-1.030684f,-1.028618f,-1.026628f,-1.024715f,-1.022877f,-1.021114f,-1.019426f,-1.017810f,-1.016268f,-1.014799f,-1.013401f,-1.012075f,-1.010820f,-1.009635f,-1.008521f,-1.007476f,-1.006501f,-1.005595f,-1.004758f,-1.003989f,-1.003289f,-1.002657f,-1.002092f,-1.001595f,-1.001166f,-1.000804f,-1.000509f,-1.000282f,-1.000121f,-1.000027f,-1.000000f,-1.000041f,-1.000148f,-1.000322f,-1.000563f,-1.000871f,-1.001247f,-1.001689f,-1.002200f,-1.002778f,-1.003424f,-1.004138f,-1.004920f,-1.005771f,-1.006691f,-1.007679f,-1.008738f,-1.009866f,-1.011065f,-1.012334f,-1.013675f,-1.015087f,-1.016571f,-1.018128f,-1.019758f,-1.021461f,-1.023239f,-1.025092f,-1.027020f,-1.029025f,-1.031106f,-1.033266f,-1.035504f,-1.037821f,-1.040218f,-1.042697f,-1.045257f,-1.047900f,-1.050628f,-1.053440f,-1.056338f,-1.059323f,-1.062397f,-1.065560f,-1.068813f,-1.072158f,-1.075597f,-1.079130f,-1.082760f,-1.086486f,-1.090312f,-1.094238f,-1.098266f,-1.102399f,-1.106637f,-1.110982f,-1.115436f,-1.120002f,-1.124680f,-1.129474f,-1.134385f,-1.139415f,-1.144567f,-1.149844f,-1.155247f,-1.160779f,-1.166443f,-1.172240f,-1.178176f,-1.184251f,-1.190470f,-1.196834f,-1.203348f,-1.210015f,-1.216838f,-1.223821f,-1.230967f,-1.238280f,-1.245765f,-1.253425f,-1.261265f,-1.269289f,-1.277502f,-1.285908f,-1.294513f,-1.303322f,-1.312340f,-1.321573f,-1.331026f,-1.340706f,-1.350619f,-1.360771f,-1.371169f,-1.381822f,-1.392734f,-1.403915f,-1.415373f,-1.427115f,-1.439150f,-1.451489f,-1.464140f,-1.477113f,-1.490419f,-1.504068f,-1.518072f,-1.532443f,-1.547192f,-1.562335f,-1.577883f,-1.593852f,-1.610256f,-1.627111f,-1.644434f,-1.662242f,-1.680555f,-1.699389f,-1.718767f,-1.738711f,-1.759241f,-1.780382f,-1.802160f,-1.824602f,-1.847734f,-1.871586f,-1.896193f,-1.921584f,-1.947796f,-1.974868f,-2.002840f,-2.031752f,-2.061652f,-2.092588f,-2.124609f,-2.157773f,-2.192137f,-2.227767f,-2.264726f,-2.303089f,-2.342936f,-2.384346f,-2.427411f,-2.472229f,-2.518909f,-2.567556f,-2.618299f,-2.671273f,-2.726619f,-2.784496f,-2.845078f,-2.908558f,-2.975135f,-3.045040f,-3.118527f,-3.195863f,-3.277358f,-3.363349f,-3.454216f,-3.550368f,-3.652278f,-3.760477f,-3.875543f,-3.998149f,-4.129051f,-4.269119f,-4.419320f,-4.580794f,-4.754856f,-4.943001f,-5.147008f,-5.368954f,-5.611311f,-5.876978f,-6.169486f,-6.493112f,-6.853033f,-7.255711f,-7.709212f,-8.223804f,-8.812601f,-9.492898f,-10.287809f,-11.228775f,-12.360110f,-13.745981f,-15.483161f,-17.724144f,-20.725237f,-24.952099f,-31.346964f,-42.152992f,-64.335106f,-135.821564f,1222.310059f,111.120583f,58.208103f,39.433578f,29.818027f,23.973820f,20.046188f,17.225317f,15.101295f,13.444393f,12.115861f,11.026951f,10.118253f,9.348496f,8.688120f,8.115394f,7.613985f,7.171381f,6.777837f,6.425647f,6.108638f,5.821809f,5.561064f,5.323015f,5.104836f,4.904155f,4.718959f,4.547534f,4.388410f,4.240321f,4.102165f,3.972985f,3.851943f,3.738301f,3.631409f,3.530689f,3.435629f,3.345772f,3.260708f,3.180070f,3.103527f,3.030780f,2.961558f,2.895618f,2.832736f,2.772708f,2.715349f,2.660491f,2.607975f,2.557661f,2.509417f,2.463120f,2.418660f,2.375932f,2.334842f,2.295300f,2.257222f,2.220535f,2.185164f,2.151045f,2.118114f,2.086314f,2.055590f,2.025891f,1.997171f,1.969383f,1.942485f,1.916440f,1.891208f,1.866756f,1.843049f,1.820058f,1.797752f,1.776103f,1.755086f,1.734675f,1.714847f,1.695579f,1.676850f,1.658640f,1.640931f,1.623703f,1.606939f,1.590623f,1.574740f,1.559274f,1.544211f,1.529538f,1.515242f,1.501310f,1.487730f,1.474492f,1.461584f,1.448996f,1.436719f,1.424743f,1.413058f,1.401657f,1.390530f,1.379670f,1.369070f,1.358721f,1.348617f,1.338751f,1.329117f,1.319709f,1.310519f,1.301544f,1.292776f,1.284211f,1.275844f,1.267669f,1.259682f,1.251878f,1.244254f,1.236804f,1.229524f,1.222411f,1.215460f,1.208669f,1.202033f,1.195549f,1.189214f,1.183025f,1.176978f,1.171070f,1.165299f,1.159662f,1.154156f,1.148778f,1.143527f,1.138399f,1.133393f,1.128505f,1.123735f,1.119079f,1.114536f,1.110104f,1.105780f,1.101564f,1.097453f,1.093445f,1.089539f,1.085733f,1.082026f,1.078416f,1.074902f,1.071482f,1.068155f,1.064920f,1.061775f,1.058719f,1.055751f,1.052870f,1.050075f,1.047365f,1.044738f,1.042194f,1.039732f,1.037351f,1.035050f,1.032827f,1.030684f,1.028618f,1.026628f,1.024715f,1.022877f,1.021114f,1.019426f,1.017810f,1.016268f,1.014799f,1.013401f,1.012075f,1.010820f,1.009635f,1.008521f,1.007476f,1.006501f,1.005595f,1.004758f,1.003989f,1.003289f,1.002657f,1.002092f,1.001595f,1.001166f,1.000804f,1.000509f,1.000282f,1.000121f,1.000027f};
  9. constexpr float inv_tan_table[768] PROGMEM {
  10.         1222.309692f,111.116081f,58.199509f,39.420898f,29.801258f,23.952953f,20.021229f,17.196266f,15.068149f,13.407151f,12.074523f,10.981514f,10.068715f,9.294858f,8.630379f,8.053547f,7.548031f,7.101317f,6.703661f,6.347357f,6.026231f,5.735282f,5.470414f,5.228239f,5.005932f,4.801118f,4.611786f,4.436222f,4.272955f,4.120718f,3.978411f,3.845077f,3.719874f,3.602068f,3.491007f,3.386114f,3.286875f,3.192834f,3.103582f,3.018749f,2.938006f,2.861053f,2.787621f,2.717463f,2.650357f,2.586100f,2.524505f,2.465403f,2.408638f,2.354067f,2.301558f,2.250991f,2.202252f,2.155239f,2.109855f,2.066010f,2.023624f,1.982618f,1.942921f,1.904467f,1.867192f,1.831039f,1.795954f,1.761884f,1.728783f,1.696605f,1.665308f,1.634852f,1.605201f,1.576318f,1.548170f,1.520727f,1.493958f,1.467836f,1.442334f,1.417426f,1.393090f,1.369302f,1.346041f,1.323287f,1.301020f,1.279222f,1.257876f,1.236965f,1.216473f,1.196384f,1.176685f,1.157362f,1.138401f,1.119790f,1.101518f,1.083571f,1.065940f,1.048614f,1.031582f,1.014836f,0.998365f,0.982161f,0.966216f,0.950521f,0.935068f,0.919849f,0.904858f,0.890087f,0.875530f,0.861180f,0.847031f,0.833076f,0.819311f,0.805728f,0.792324f,0.779092f,0.766028f,0.753126f,0.740383f,0.727793f,0.715352f,0.703056f,0.690901f,0.678882f,0.666996f,0.655239f,0.643607f,0.632097f,0.620706f,0.609430f,0.598265f,0.587210f,0.576260f,0.565413f,0.554666f,0.544016f,0.533460f,0.522996f,0.512621f,0.502333f,0.492129f,0.482007f,0.471964f,0.461999f,0.452108f,0.442291f,0.432544f,0.422866f,0.413255f,0.403709f,0.394225f,0.384803f,0.375440f,0.366134f,0.356883f,0.347686f,0.338542f,0.329448f,0.320403f,0.311405f,0.302453f,0.293546f,0.284681f,0.275857f,0.267073f,0.258327f,0.249618f,0.240944f,0.232305f,0.223698f,0.215123f,0.206578f,0.198062f,0.189573f,0.181111f,0.172674f,0.164260f,0.155869f,0.147500f,0.139151f,0.130820f,0.122508f,0.114212f,0.105931f,0.097665f,0.089413f,0.081172f,0.072942f,0.064722f,0.056510f,0.048307f,0.040110f,0.031918f,0.023730f,0.015546f,0.007363f,-0.000818f,-0.009000f,-0.017182f,-0.025367f,-0.033556f,-0.041749f,-0.049947f,-0.058152f,-0.066365f,-0.074587f,-0.082819f,-0.091062f,-0.099318f,-0.107586f,-0.115870f,-0.124169f,-0.132485f,-0.140819f,-0.149172f,-0.157546f,-0.165941f,-0.174359f,-0.182802f,-0.191269f,-0.199763f,-0.208285f,-0.216836f,-0.225417f,-0.234030f,-0.242676f,-0.251357f,-0.260073f,-0.268826f,-0.277618f,-0.286450f,-0.295324f,-0.304240f,-0.313201f,-0.322208f,-0.331263f,-0.340367f,-0.349522f,-0.358729f,-0.367990f,-0.377308f,-0.386683f,-0.396117f,-0.405613f,-0.415172f,-0.424797f,-0.434488f,-0.444249f,-0.454081f,-0.463986f,-0.473966f,-0.484025f,-0.494163f,-0.504383f,-0.514689f,-0.525081f,-0.535563f,-0.546138f,-0.556807f,-0.567574f,-0.578442f,-0.589412f,-0.600489f,-0.611676f,-0.622975f,-0.634390f,-0.645923f,-0.657580f,-0.669363f,-0.681275f,-0.693321f,-0.705504f,-0.717829f,-0.730299f,-0.742919f,-0.755694f,-0.768628f,-0.781725f,-0.794991f,-0.808430f,-0.822049f,-0.835852f,-0.849845f,-0.864034f,-0.878425f,-0.893024f,-0.907838f,-0.922874f,-0.938139f,-0.953640f,-0.969385f,-0.985381f,-1.001637f,-1.018163f,-1.034965f,-1.052055f,-1.069442f,-1.087135f,-1.105146f,-1.123485f,-1.142165f,-1.161197f,-1.180595f,-1.200371f,-1.220538f,-1.241113f,-1.262110f,-1.283545f,-1.305435f,-1.327798f,-1.350652f,-1.374016f,-1.397913f,-1.422361f,-1.447386f,-1.473010f,-1.499259f,-1.526161f,-1.553742f,-1.582035f,-1.611068f,-1.640878f,-1.671498f,-1.702969f,-1.735327f,-1.768619f,-1.802888f,-1.838183f,-1.874556f,-1.912061f,-1.950759f,-1.990712f,-2.031988f,-2.074661f,-2.118805f,-2.164508f,-2.211858f,-2.260955f,-2.311901f,-2.364812f,-2.419811f,-2.477031f,-2.536619f,-2.598731f,-2.663544f,-2.731242f,-2.802037f,-2.876154f,-2.953841f,-3.035379f,-3.121066f,-3.211247f,-3.306292f,-3.406624f,-3.512709f,-3.625070f,-3.744302f,-3.871066f,-4.006126f,-4.150336f,-4.304688f,-4.470308f,-4.648499f,-4.840783f,-5.048921f,-5.275002f,-5.521469f,-5.791265f,-6.087899f,-6.415622f,-6.779665f,-7.186452f,-7.644075f,-8.162740f,-8.755655f,-9.440072f,-10.239033f,-11.184117f,-12.319541f,-13.709541f,-15.450698f,-17.695808f,-20.701059f,-24.931700f,-31.330688f,-42.140549f,-64.326965f,-135.807480f,1222.341797f,111.115082f,58.199692f,39.420826f,29.801334f,23.952942f,20.021278f,17.196272f,15.068132f,13.407162f,12.074515f,10.981524f,10.068714f,9.294868f,8.630380f,8.053541f,7.548034f,7.101315f,6.703665f,6.347355f,6.026235f,5.735283f,5.470411f,5.228240f,5.005930f,4.801120f,4.611785f,4.436224f,4.272955f,4.120717f,3.978412f,3.845076f,3.719876f,3.602068f,3.491009f,3.386114f,3.286874f,3.192835f,3.103581f,3.018750f,2.938006f,2.861054f,2.787621f,2.717462f,2.650357f,2.586099f,2.524505f,2.465403f,2.408639f,2.354067f,2.301558f,2.250991f,2.202252f,2.155239f,2.109854f,2.066011f,2.023624f,1.982618f,1.942922f,1.904467f,1.867193f,1.831039f,1.795954f,1.761884f,1.728783f,1.696605f,1.665308f,1.634853f,1.605201f,1.576318f,1.548170f,1.520728f,1.493958f,1.467836f,1.442334f,1.417426f,1.393090f,1.369302f,1.346041f,1.323287f,1.301020f,1.279222f,1.257876f,1.236965f,1.216473f,1.196385f,1.176685f,1.157362f,1.138401f,1.119790f,1.101518f,1.083571f,1.065940f,1.048614f,1.031582f,1.014836f,0.998365f,0.982162f,0.966216f,0.950521f,0.935068f,0.919849f,0.904858f,0.890087f,0.875530f,0.861180f,0.847030f,0.833076f,0.819310f,0.805728f,0.792323f,0.779092f,0.766028f,0.753126f,0.740383f,0.727793f,0.715352f,0.703056f,0.690901f,0.678882f,0.666995f,0.655239f,0.643607f,0.632097f,0.620706f,0.609430f,0.598265f,0.587209f,0.576260f,0.565413f,0.554665f,0.544015f,0.533459f,0.522996f,0.512620f,0.502332f,0.492129f,0.482006f,0.471964f,0.461998f,0.452108f,0.442291f,0.432544f,0.422866f,0.413255f,0.403709f,0.394225f,0.384803f,0.375439f,0.366133f,0.356883f,0.347686f,0.338542f,0.329448f,0.320403f,0.311405f,0.302453f,0.293546f,0.284680f,0.275856f,0.267072f,0.258327f,0.249617f,0.240944f,0.232305f,0.223698f,0.215123f,0.206578f,0.198062f,0.189573f,0.181111f,0.172674f,0.164260f,0.155869f,0.147500f,0.139151f,0.130820f,0.122507f,0.114212f,0.105931f,0.097665f,0.089412f,0.081172f,0.072941f,0.064722f,0.056510f,0.048306f,0.040109f,0.031917f,0.023730f,0.015545f,0.007363f,-0.000818f,-0.009000f,-0.017183f,-0.025367f,-0.033556f,-0.041749f,-0.049947f,-0.058152f,-0.066366f,-0.074587f,-0.082819f,-0.091062f,-0.099318f,-0.107587f,-0.115870f,-0.124169f,-0.132485f,-0.140819f,-0.149172f,-0.157546f,-0.165942f,-0.174359f,-0.182802f,-0.191269f,-0.199763f,-0.208285f,-0.216836f,-0.225417f,-0.234030f,-0.242677f,-0.251357f,-0.260073f,-0.268826f,-0.277619f,-0.286451f,-0.295324f,-0.304241f,-0.313202f,-0.322209f,-0.331263f,-0.340367f,-0.349522f,-0.358729f,-0.367991f,-0.377308f,-0.386683f,-0.396117f,-0.405614f,-0.415173f,-0.424797f,-0.434489f,-0.444249f,-0.454081f,-0.463986f,-0.473967f,-0.484025f,-0.494163f,-0.504384f,-0.514689f,-0.525082f,-0.535564f,-0.546138f,-0.556808f,-0.567574f,-0.578442f,-0.589413f,-0.600490f,-0.611676f,-0.622976f,-0.634390f,-0.645924f,-0.657580f,-0.669363f,-0.681275f,-0.693321f,-0.705505f,-0.717829f,-0.730299f,-0.742920f,-0.755695f,-0.768628f,-0.781725f,-0.794991f,-0.808431f,-0.822049f,-0.835852f,-0.849845f,-0.864034f,-0.878425f,-0.893025f,-0.907839f,-0.922875f,-0.938139f,-0.953641f,-0.969385f,-0.985381f,-1.001639f,-1.018163f,-1.034966f,-1.052055f,-1.069442f,-1.087135f,-1.105146f,-1.123486f,-1.142166f,-1.161198f,-1.180595f,-1.200371f,-1.220539f,-1.241114f,-1.262111f,-1.283546f,-1.305436f,-1.327798f,-1.350653f,-1.374017f,-1.397913f,-1.422363f,-1.447387f,-1.473011f,-1.499260f,-1.526162f,-1.553744f,-1.582035f,-1.611070f,-1.640879f,-1.671500f,-1.702969f,-1.735330f,-1.768620f,-1.802889f,-1.838185f,-1.874557f,-1.912062f,-1.950760f,-1.990714f,-2.031990f,-2.074661f,-2.118808f,-2.164510f,-2.211860f,-2.260955f,-2.311904f,-2.364814f,-2.419812f,-2.477035f,-2.536622f,-2.598734f,-2.663545f,-2.731247f,-2.802040f,-2.876155f,-2.953847f,-3.035382f,-3.121070f,-3.211248f,-3.306298f,-3.406628f,-3.512711f,-3.625077f,-3.744307f,-3.871072f,-4.006128f,-4.150346f,-4.304694f,-4.470310f,-4.648511f,-4.840791f,-5.048930f,-5.275004f,-5.521486f,-5.791276f,-6.087902f,-6.415646f,-6.779680f,-7.186469f,-7.644080f,-8.162778f,-8.755681f,-9.440080f,-10.239093f,-11.184158f,-12.319591f,-13.709558f,-15.450833f,-17.695911f,-20.701097f,-24.932053f,-31.331007f,-42.141125f,-64.327332f,-135.817886f};
  11. constexpr float cos_table[128] PROGMEM {
  12.         8079.090332f,8041.448242f,8004.688965f,7968.794922f,7933.749512f,7899.538086f,7866.144531f,7833.554199f,7801.752930f,7770.726563f,7740.461914f,7710.946289f,7682.167480f,7654.112793f,7626.770996f,7600.130859f,7574.181152f,7548.911621f,7524.312500f,7500.373047f,7477.083984f,7454.437012f,7432.422852f,7411.032715f,7390.258789f,7370.092773f,7350.527344f,7331.554688f,7313.167969f,7295.360840f,7278.125000f,7261.456055f,7245.347656f,7229.792480f,7214.786621f,7200.323242f,7186.397461f,7173.005371f,7160.141113f,7147.800293f,7135.979004f,7124.673340f,7113.877930f,7103.590332f,7093.806641f,7084.523438f,7075.737305f,7067.444824f,7059.644531f,7052.333008f,7045.507324f,7039.165527f,7033.305664f,7027.925293f,7023.023438f,7018.597168f,7014.645996f,7011.168457f,7008.162598f,7005.628418f,7003.564453f,7001.970703f,7000.845703f,7000.189941f,7000.002441f,7000.283203f,7001.033203f,7002.251465f,7003.939453f,7006.097656f,7008.726074f,7011.826172f,7015.398438f,7019.444336f,7023.965332f,7028.962891f,7034.439453f,7040.395508f,7046.833496f,7053.756348f,7061.166016f,7069.063965f,7077.455078f,7086.340332f,7095.723145f,7105.607422f,7115.996582f,7126.893555f,7138.302246f,7150.227051f,7162.671875f,7175.641113f,7189.140137f,7203.172852f,7217.744141f,7232.859375f,7248.524902f,7264.745117f,7281.526855f,7298.875977f,7316.798828f,7335.302246f,7354.393066f,7374.078125f,7394.364746f,7415.261719f,7436.775391f,7458.916016f,7481.690430f,7505.108398f,7529.179199f,7553.911621f,7579.316406f,7605.403320f,7632.183105f,7659.666504f,7687.865234f,7716.790527f,7746.454590f,7776.870605f,7808.050293f,7840.008301f,7872.758301f,7906.314453f,7940.691895f,7975.905273f,8011.971191f,8048.905762f};
  13. const float* inv_cos_table = &inv_sin_table[192];
  14. tan_table(768): -1222.23 <-> 135.815
  15. y_step(768): -512 <-> 512
  16. x_step(768): -512 <-> 512
  17. inv_sin_table(960): -1222.34 <-> 1222.31
  18. inv_tan_table(768): -135.818 <-> 1222.34
  19. cos_table(128): 7000 <-> 8079.09
  20.  
  21.  
  22.  
  23. //To generate the above tables:
  24. static constexpr auto RAY_COUNT = Cfg::VIEWPORT_WIDTH; //one ray per column of screen space (horizontal resolution)
  25. static constexpr auto FOV_DEGREES = 60; //Field of View, in degrees. We'll need to break these into RAY_COUNT sub-angles and cast a ray for each angle. We'll be using a lookup table for that         
  26. static constexpr auto TABLE_SIZE = static_cast<int>(VIEWPORT_WIDTH* (360.0f / FOV_DEGREES)); //how many elements we need to store the slope of every possible ray that can be projected.        
  27. static constexpr auto ANGLE_360 = Cfg::TABLE_SIZE; //East (and total number of possible angles in a full rotation)
  28. static constexpr auto ANGLE_90 = ANGLE_360 / 4; //South
  29. static constexpr auto ANGLE_180 = ANGLE_360 / 2; //West
  30. static constexpr auto ANGLE_270 = ANGLE_360 - ANGLE_90; //North
  31. static constexpr auto ANGLE_0 = 0;  //back to East
  32. static constexpr auto TWO_PI = 2.0f * 3.141592654f;
  33. static constexpr auto ANGLE_TO_RADIANS = (TWO_PI / ANGLE_360);
  34. static constexpr auto HALF_FOV_ANGLE = Cfg::VIEWPORT_WIDTH / 2; // FoV/2 in angles (for table lookup) instead of degrees.    
  35. static constexpr auto K = 7000.0f;// think of K as a combination of view distance and aspect ratio. Pick a value that looks good. In my case: that makes the block on screen look square.
  36.  
  37. // tangent tables equivalent to slopes, used to compute initial intersections with ray
  38. std::array<float, ANGLE_360> tan_table;
  39. std::array<float, ANGLE_360> inv_tan_table;
  40.  
  41. // step tables used to find next intersections, equivalent to slopes times width and height of cell    
  42. std::array<float, ANGLE_360> y_step; //x and y steps, used to find intersections after initial one is found
  43. std::array<float, ANGLE_360> x_step;
  44.  
  45. // 1/cos and 1/sin tables used to compute distance of intersection very quickly  
  46. // Optimization: cos(X) == sin(X+90), so for cos lookups we can simply re-use the sin-table with an offset of ANGLE_90.    
  47. std::array<float, ANGLE_360 + ANGLE_90> inv_sin_table; //+90 degrees to make room for the tail-end of the offset cos values.    
  48. float* inv_cos_table = &inv_sin_table[ANGLE_90]; //cos(X) == sin(X+90).    
  49.  
  50. // cos table used to fix view distortion caused by radial projection (eg: cancel out fishbowl effect)
  51. std::array<float, HALF_FOV_ANGLE * 2> cos_table;
  52.  
  53. void buildLookupTables() noexcept  {
  54.     constexpr auto TENTH_OF_A_RADIAN = ANGLE_TO_RADIANS * 0.1f;
  55.     constexpr auto MAX_STEP = 512.0f; //seems we never need more than this, so let's cap the values in the LUT. (potentially allow us to use a smaller datatype later on)
  56.     for (int ang = ANGLE_0; ang < ANGLE_360; ang++) {
  57.         const auto rad_angle = TENTH_OF_A_RADIAN + (ang * ANGLE_TO_RADIANS); //adding a small offset to avoid edge cases with 0.
  58.         tan_table[ang] = std::tan(rad_angle);
  59.         inv_tan_table[ang] = 1.0f / tan_table[ang];
  60.         // tangent has the incorrect signs in all quadrants except 1, so manually fix the signs of each quadrant.
  61.         if (ang >= ANGLE_0 && ang < ANGLE_180) { //upper half plane (eg. upper right & left quadrants)
  62.             y_step[ang] = std::abs(tan_table[ang] * CELL_SIZE);
  63.         } else {
  64.             y_step[ang] = -std::abs(tan_table[ang] * CELL_SIZE);
  65.         }
  66.         if (ang >= ANGLE_90 && ang < ANGLE_270) { //left half plane (left up and down quads)
  67.             x_step[ang] = -std::abs(inv_tan_table[ang] * CELL_SIZE);
  68.         } else {
  69.             x_step[ang] = std::abs(inv_tan_table[ang] * CELL_SIZE);
  70.         }
  71.         x_step[ang] = Utils::clamp(x_step[ang], -MAX_STEP, MAX_STEP);
  72.         y_step[ang] = Utils::clamp(y_step[ang], -MAX_STEP, MAX_STEP);
  73.         assert(std::fabs(y_step[ang]) != 0.0f && "Potential asymtotic ray on the y-axis produced while building lookup tables.");
  74.         assert(std::fabs(x_step[ang]) != 0.0f && "Potential asymtotic ray on the x-axis produced while building lookup tables.");
  75.         inv_sin_table[ang] = 1.0f / std::sin(rad_angle);
  76.     }
  77.  
  78.     //duplicate the first 90 sin values at the end of the array, to complete the joint sin & cos lookup table.
  79.     auto end = std::end(inv_sin_table) - ANGLE_90;
  80.     std::copy_n(std::begin(inv_sin_table), ANGLE_90, end);
  81.  
  82.     // create view filter table. Without this we would see a fishbowl effect. There is a cosine wave modulated on top of the view distance as a side effect of casting from a fixed point.
  83.     // to cancel this effect out, we multiple by the inverse of the cosine and the result is the proper scale.
  84.     // inverse cosine would be 1/cos(rad_angle), but 1 is too small to give us good sized slivers, hence the constant K which is arbitrarily chosen for what looks good.
  85.     for (int ang = -HALF_FOV_ANGLE; ang < HALF_FOV_ANGLE; ang++) {
  86.         const auto rad_angle = TENTH_OF_A_RADIAN + (ang * ANGLE_TO_RADIANS);
  87.         const auto index = ang + HALF_FOV_ANGLE;
  88.         cos_table[index] = (K / std::cos(rad_angle));
  89.     }
  90. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top