From 34e73e4d7dfda9b37558e961428a1335291e0d23 Mon Sep 17 00:00:00 2001 From: jacob1 Date: Thu, 5 Apr 2018 23:07:29 -0400 Subject: [PATCH] remove asin/acos because they aren't necessary and don't work --- data/TrigTables.h | 1032 --------------------------------------- src/common/tpt-math.cpp | 28 +- 2 files changed, 6 insertions(+), 1054 deletions(-) diff --git a/data/TrigTables.h b/data/TrigTables.h index fb99d450b..021453d1c 100644 --- a/data/TrigTables.h +++ b/data/TrigTables.h @@ -1545,1038 +1545,6 @@ const static float tanLookupTable[] 0.0 }; -const static float asinLookupTable[] -{ - -1.57079632679, - -1.48237918158, - -1.4457148032, - -1.4175533173, - -1.39378864051, - -1.3728308676, - -1.35386486626, - -1.33640656529, - -1.32014066446, - -1.30484822305, - -1.29036988019, - -1.2765853674, - -1.26340127571, - -1.25074334357, - -1.23855137737, - -1.22677578305, - -1.2153751251, - -1.20431436395, - -1.19356355444, - -1.18309686624, - -1.17289183377, - -1.16292877326, - -1.15319032349, - -1.14366107962, - -1.13432729806, - -1.12517665614, - -1.11619805478, - -1.10738145496, - -1.09871774132, - -1.09019860745, - -1.08181645891, - -1.07356433068, - -1.06543581651, - -1.05742500815, - -1.04952644282, - -1.04173505759, - -1.03404614957, - -1.02645534109, - -1.0189585491, - -1.00423199617, - -0.996995313961, - -0.989838765502, - -0.982759391463, - -0.975754403967, - -0.968821173003, - -0.961957214179, - -0.955160177673, - -0.94842783824, - -0.941758086146, - -0.935148918939, - -0.928598433952, - -0.922104821467, - -0.915666358474, - -0.90928140295, - -0.902948388616, - -0.896665820128, - -0.890432268642, - -0.88424636774, - -0.878106809661, - -0.872012341827, - -0.865961763622, - -0.859953923414, - -0.853987715789, - -0.848062078981, - -0.84217599249, - -0.83632847485, - -0.830518581569, - -0.824745403185, - -0.81900806347, - -0.813305717737, - -0.807637551261, - -0.802002777804, - -0.796400638222, - -0.79083039917, - -0.785291351873, - -0.77978281098, - -0.774304113483, - -0.768854617696, - -0.763433702298, - -0.758040765426, - -0.752675223824, - -0.747336512031, - -0.742024081623, - -0.73673740049, - -0.73147595215, - -0.72623923511, - -0.721026762246, - -0.715838060225, - -0.710672668953, - -0.70553014105, - -0.700410041357, - -0.695311946457, - -0.690235444228, - -0.685180133417, - -0.680145623228, - -0.675131532937, - -0.670137491521, - -0.665163137305, - -0.660208117623, - -0.655272088501, - -0.650354714345, - -0.64545566765, - -0.640574628721, - -0.635711285401, - -0.630865332818, - -0.626036473137, - -0.621224415323, - -0.616428874922, - -0.611649573837, - -0.606886240126, - -0.602138607804, - -0.597406416645, - -0.59268941201, - -0.587987344661, - -0.5832999706, - -0.578627050899, - -0.573968351552, - -0.569323643321, - -0.564692701589, - -0.560075306227, - -0.555471241455, - -0.550880295719, - -0.546302261559, - -0.541736935498, - -0.537184117921, - -0.532643612966, - -0.528115228416, - -0.523598775598, - -0.51909406928, - -0.514600927577, - -0.510119171857, - -0.505648626651, - -0.501189119568, - -0.496740481208, - -0.492302545083, - -0.48787514754, - -0.483458127682, - -0.479051327296, - -0.474654590783, - -0.470267765086, - -0.465890699629, - -0.461523246247, - -0.457165259127, - -0.452816594745, - -0.44847711181, - -0.444146671205, - -0.439825135934, - -0.435512371064, - -0.431208243681, - -0.42691262283, - -0.422625379474, - -0.418346386443, - -0.41407551839, - -0.40981265174, - -0.405557664658, - -0.401310436994, - -0.397070850251, - -0.392838787543, - -0.388614133552, - -0.384396774496, - -0.380186598088, - -0.375983493504, - -0.371787351345, - -0.367598063603, - -0.363415523632, - -0.359239626112, - -0.355070267018, - -0.350907343591, - -0.346750754309, - -0.342600398856, - -0.338456178094, - -0.334317994036, - -0.330185749821, - -0.326059349685, - -0.321938698935, - -0.317823703928, - -0.313714272043, - -0.309610311658, - -0.305511732128, - -0.301418443762, - -0.2973303578, - -0.293247386391, - -0.289169442573, - -0.285096440253, - -0.281028294184, - -0.276964919949, - -0.272906233937, - -0.268852153328, - -0.264802596075, - -0.26075748088, - -0.256716727184, - -0.252680255142, - -0.248647985613, - -0.244619840139, - -0.24059574093, - -0.236575610846, - -0.232559373384, - -0.228546952662, - -0.224538273403, - -0.220533260921, - -0.216531841104, - -0.212533940404, - -0.208539485819, - -0.204548404881, - -0.200560625642, - -0.196576076663, - -0.192594686996, - -0.188616386175, - -0.184641104203, - -0.180668771538, - -0.17669931908, - -0.172732678164, - -0.168768780543, - -0.164807558376, - -0.160848944221, - -0.15689287102, - -0.15293927209, - -0.148988081108, - -0.145039232106, - -0.141092659456, - -0.13714829786, - -0.133206082342, - -0.129265948234, - -0.125327831168, - -0.121391667067, - -0.117457392133, - -0.113524942837, - -0.109594255911, - -0.105665268336, - -0.101737917338, - -0.097812140369, - -0.0938878751075, - -0.0899650594431, - -0.0860436314695, - -0.0821235294753, - -0.0782046919348, - -0.0742870574989, - -0.0703705649867, - -0.0664551533764, - -0.0625407617965, - -0.0586273295174, - -0.0547147959424, - -0.0508031005997, - -0.0468921831333, - -0.0429819832947, - -0.0390724409349, - -0.0351634959952, - -0.0312550884995, - -0.0273471585458, - -0.0234396462978, - -0.0195324919766, - -0.0156256358527, - -0.0117190182375, - -0.00781257947504, - -0.00390625993418, - 0.0, - 0.00390625993418, - 0.00781257947504, - 0.0117190182375, - 0.0156256358527, - 0.0195324919766, - 0.0234396462978, - 0.0273471585458, - 0.0312550884995, - 0.0351634959952, - 0.0390724409349, - 0.0429819832947, - 0.0468921831333, - 0.0508031005997, - 0.0547147959424, - 0.0586273295174, - 0.0625407617965, - 0.0664551533764, - 0.0703705649867, - 0.0742870574989, - 0.0782046919348, - 0.0821235294753, - 0.0860436314695, - 0.0899650594431, - 0.0938878751075, - 0.097812140369, - 0.101737917338, - 0.105665268336, - 0.109594255911, - 0.113524942837, - 0.117457392133, - 0.121391667067, - 0.125327831168, - 0.129265948234, - 0.133206082342, - 0.13714829786, - 0.141092659456, - 0.145039232106, - 0.148988081108, - 0.15293927209, - 0.15689287102, - 0.160848944221, - 0.164807558376, - 0.168768780543, - 0.172732678164, - 0.17669931908, - 0.180668771538, - 0.184641104203, - 0.188616386175, - 0.192594686996, - 0.196576076663, - 0.200560625642, - 0.204548404881, - 0.208539485819, - 0.212533940404, - 0.216531841104, - 0.220533260921, - 0.224538273403, - 0.228546952662, - 0.232559373384, - 0.236575610846, - 0.24059574093, - 0.244619840139, - 0.248647985613, - 0.252680255142, - 0.256716727184, - 0.26075748088, - 0.264802596075, - 0.268852153328, - 0.272906233937, - 0.276964919949, - 0.281028294184, - 0.285096440253, - 0.289169442573, - 0.293247386391, - 0.2973303578, - 0.301418443762, - 0.305511732128, - 0.309610311658, - 0.313714272043, - 0.317823703928, - 0.321938698935, - 0.326059349685, - 0.330185749821, - 0.334317994036, - 0.338456178094, - 0.342600398856, - 0.346750754309, - 0.350907343591, - 0.355070267018, - 0.359239626112, - 0.363415523632, - 0.367598063603, - 0.371787351345, - 0.375983493504, - 0.380186598088, - 0.384396774496, - 0.388614133552, - 0.392838787543, - 0.397070850251, - 0.401310436994, - 0.405557664658, - 0.40981265174, - 0.41407551839, - 0.418346386443, - 0.422625379474, - 0.42691262283, - 0.431208243681, - 0.435512371064, - 0.439825135934, - 0.444146671205, - 0.44847711181, - 0.452816594745, - 0.457165259127, - 0.461523246247, - 0.465890699629, - 0.470267765086, - 0.474654590783, - 0.479051327296, - 0.483458127682, - 0.48787514754, - 0.492302545083, - 0.496740481208, - 0.501189119568, - 0.505648626651, - 0.510119171857, - 0.514600927577, - 0.51909406928, - 0.523598775598, - 0.528115228416, - 0.532643612966, - 0.537184117921, - 0.541736935498, - 0.546302261559, - 0.550880295719, - 0.555471241455, - 0.560075306227, - 0.564692701589, - 0.569323643321, - 0.573968351552, - 0.578627050899, - 0.5832999706, - 0.587987344661, - 0.59268941201, - 0.597406416645, - 0.602138607804, - 0.606886240126, - 0.611649573837, - 0.616428874922, - 0.621224415323, - 0.626036473137, - 0.630865332818, - 0.635711285401, - 0.640574628721, - 0.64545566765, - 0.650354714345, - 0.655272088501, - 0.660208117623, - 0.665163137305, - 0.670137491521, - 0.675131532937, - 0.680145623228, - 0.685180133417, - 0.690235444228, - 0.695311946457, - 0.700410041357, - 0.70553014105, - 0.710672668953, - 0.715838060225, - 0.721026762246, - 0.72623923511, - 0.73147595215, - 0.73673740049, - 0.742024081623, - 0.747336512031, - 0.752675223824, - 0.758040765426, - 0.763433702298, - 0.768854617696, - 0.774304113483, - 0.77978281098, - 0.785291351873, - 0.79083039917, - 0.796400638222, - 0.802002777804, - 0.807637551261, - 0.813305717737, - 0.81900806347, - 0.824745403185, - 0.830518581569, - 0.83632847485, - 0.84217599249, - 0.848062078981, - 0.853987715789, - 0.859953923414, - 0.865961763622, - 0.872012341827, - 0.878106809661, - 0.88424636774, - 0.890432268642, - 0.896665820128, - 0.902948388616, - 0.90928140295, - 0.915666358474, - 0.922104821467, - 0.928598433952, - 0.935148918939, - 0.941758086146, - 0.94842783824, - 0.955160177673, - 0.961957214179, - 0.968821173003, - 0.975754403967, - 0.982759391463, - 0.989838765502, - 0.996995313961, - 1.00423199617, - 1.01155195808, - 1.0189585491, - 1.02645534109, - 1.03404614957, - 1.04173505759, - 1.04952644282, - 1.05742500815, - 1.06543581651, - 1.07356433068, - 1.08181645891, - 1.09019860745, - 1.09871774132, - 1.10738145496, - 1.11619805478, - 1.12517665614, - 1.13432729806, - 1.14366107962, - 1.15319032349, - 1.16292877326, - 1.17289183377, - 1.18309686624, - 1.19356355444, - 1.20431436395, - 1.2153751251, - 1.22677578305, - 1.23855137737, - 1.25074334357, - 1.26340127571, - 1.2765853674, - 1.29036988019, - 1.30484822305, - 1.32014066446, - 1.33640656529, - 1.35386486626, - 1.3728308676, - 1.39378864051, - 1.4175533173, - 1.4457148032, - 1.48237918158, - 1.57079632679 -}; - -const static float acosLookupTable[] -{ - 3.14159265359, - 3.05317550838, - 3.01651113, - 2.98834964409, - 2.9645849673, - 2.94362719439, - 2.92466119305, - 2.90720289209, - 2.89093699125, - 2.87564454985, - 2.86116620699, - 2.8473816942, - 2.83419760251, - 2.82153967037, - 2.80934770417, - 2.79757210984, - 2.7861714519, - 2.77511069075, - 2.76435988124, - 2.75389319303, - 2.74368816056, - 2.73372510005, - 2.72398665028, - 2.71445740642, - 2.70512362485, - 2.69597298294, - 2.68699438157, - 2.67817778176, - 2.66951406811, - 2.66099493424, - 2.6526127857, - 2.64436065747, - 2.63623214331, - 2.62822133495, - 2.62032276962, - 2.61253138438, - 2.60484247636, - 2.59725166789, - 2.58975487589, - 2.58234828487, - 2.57502832297, - 2.56779164076, - 2.5606350923, - 2.55355571826, - 2.54655073076, - 2.5396174998, - 2.53275354097, - 2.52595650447, - 2.51922416503, - 2.51255441294, - 2.50594524573, - 2.49939476075, - 2.49290114826, - 2.48646268527, - 2.48007772974, - 2.47374471541, - 2.46746214692, - 2.46122859544, - 2.45504269453, - 2.44890313646, - 2.44280866862, - 2.43675809042, - 2.43075025021, - 2.42478404258, - 2.41885840578, - 2.41297231928, - 2.40712480165, - 2.40131490836, - 2.39554172998, - 2.38980439027, - 2.38410204453, - 2.37843387806, - 2.3727991046, - 2.36719696502, - 2.36162672597, - 2.35608767867, - 2.35057913778, - 2.34510044028, - 2.33965094449, - 2.33423002909, - 2.32883709222, - 2.32347155062, - 2.31813283883, - 2.31282040842, - 2.30753372728, - 2.30227227895, - 2.29703556191, - 2.29182308904, - 2.28663438702, - 2.28146899575, - 2.27632646785, - 2.27120636815, - 2.26610827325, - 2.26103177102, - 2.25597646021, - 2.25094195002, - 2.24592785973, - 2.24093381832, - 2.2359594641, - 2.23100444442, - 2.2260684153, - 2.22115104114, - 2.21625199444, - 2.21137095552, - 2.2065076122, - 2.20166165961, - 2.19683279993, - 2.19202074212, - 2.18722520172, - 2.18244590063, - 2.17768256692, - 2.1729349346, - 2.16820274344, - 2.16348573881, - 2.15878367146, - 2.15409629739, - 2.14942337769, - 2.14476467835, - 2.14011997012, - 2.13548902838, - 2.13087163302, - 2.12626756825, - 2.12167662251, - 2.11709858835, - 2.11253326229, - 2.10798044472, - 2.10343993976, - 2.09891155521, - 2.09439510239, - 2.08989039608, - 2.08539725437, - 2.08091549865, - 2.07644495345, - 2.07198544636, - 2.067536808, - 2.06309887188, - 2.05867147434, - 2.05425445448, - 2.04984765409, - 2.04545091758, - 2.04106409188, - 2.03668702642, - 2.03231957304, - 2.02796158592, - 2.02361292154, - 2.0192734386, - 2.014942998, - 2.01062146273, - 2.00630869786, - 2.00200457048, - 1.99770894962, - 1.99342170627, - 1.98914271324, - 1.98487184518, - 1.98060897854, - 1.97635399145, - 1.97210676379, - 1.96786717705, - 1.96363511434, - 1.95941046035, - 1.95519310129, - 1.95098292488, - 1.9467798203, - 1.94258367814, - 1.9383943904, - 1.93421185043, - 1.93003595291, - 1.92586659381, - 1.92170367039, - 1.9175470811, - 1.91339672565, - 1.90925250489, - 1.90511432083, - 1.90098207662, - 1.89685567648, - 1.89273502573, - 1.88862003072, - 1.88451059884, - 1.88040663845, - 1.87630805892, - 1.87221477056, - 1.86812668459, - 1.86404371319, - 1.85996576937, - 1.85589276705, - 1.85182462098, - 1.84776124674, - 1.84370256073, - 1.83559892287, - 1.83155380768, - 1.82751305398, - 1.82347658194, - 1.81944431241, - 1.81541616693, - 1.81139206772, - 1.80737193764, - 1.80335570018, - 1.79934327946, - 1.7953346002, - 1.79132958772, - 1.7873281679, - 1.7833302672, - 1.77933581261, - 1.77534473168, - 1.77135695244, - 1.76737240346, - 1.76339101379, - 1.75941271297, - 1.755437431, - 1.75146509833, - 1.74749564588, - 1.74352900496, - 1.73956510734, - 1.73560388517, - 1.73164527102, - 1.72768919782, - 1.72373559888, - 1.7197844079, - 1.7158355589, - 1.71188898625, - 1.70794462466, - 1.70400240914, - 1.70006227503, - 1.69612415796, - 1.69218799386, - 1.68825371893, - 1.68432126963, - 1.68039058271, - 1.67646159513, - 1.67253424413, - 1.66860846716, - 1.6646842019, - 1.66076138624, - 1.65683995826, - 1.65291985627, - 1.64900101873, - 1.64508338429, - 1.64116689178, - 1.63725148017, - 1.63333708859, - 1.62942365631, - 1.62551112274, - 1.62159942739, - 1.61768850993, - 1.61377831009, - 1.60986876773, - 1.60595982279, - 1.60205141529, - 1.59814348534, - 1.59423597309, - 1.59032881877, - 1.58642196265, - 1.58251534503, - 1.57860890627, - 1.57470258673, - 1.57079632679, - 1.56689006686, - 1.56298374732, - 1.55907730856, - 1.55517069094, - 1.55126383482, - 1.5473566805, - 1.54344916825, - 1.5395412383, - 1.5356328308, - 1.53172388586, - 1.5278143435, - 1.52390414366, - 1.5199932262, - 1.51608153085, - 1.51216899728, - 1.508255565, - 1.50434117342, - 1.50042576181, - 1.4965092693, - 1.49259163486, - 1.48867279732, - 1.48475269533, - 1.48083126735, - 1.47690845169, - 1.47298418643, - 1.46905840946, - 1.46513105846, - 1.46120207088, - 1.45727138396, - 1.45333893466, - 1.44940465973, - 1.44546849563, - 1.44153037856, - 1.43759024445, - 1.43364802893, - 1.42970366734, - 1.42575709469, - 1.42180824569, - 1.41785705471, - 1.41390345577, - 1.40994738257, - 1.40598876842, - 1.40202754625, - 1.39806364863, - 1.39409700771, - 1.39012755526, - 1.38615522259, - 1.38217994062, - 1.3782016398, - 1.37422025013, - 1.37023570115, - 1.36624792191, - 1.36225684098, - 1.35826238639, - 1.35426448569, - 1.35026306587, - 1.34625805339, - 1.34224937413, - 1.33823695341, - 1.33422071595, - 1.33020058587, - 1.32617648666, - 1.32214834118, - 1.31811607165, - 1.31407959961, - 1.31003884591, - 1.30599373072, - 1.30194417347, - 1.29789009286, - 1.29383140685, - 1.28976803261, - 1.28569988654, - 1.28162688422, - 1.2775489404, - 1.273465969, - 1.26937788303, - 1.26528459467, - 1.26118601514, - 1.25708205475, - 1.25297262287, - 1.24885762786, - 1.24473697711, - 1.24061057697, - 1.23647833276, - 1.2323401487, - 1.22819592794, - 1.22404557249, - 1.2198889832, - 1.21572605978, - 1.21155670068, - 1.20738080316, - 1.20319826319, - 1.19900897545, - 1.19481283329, - 1.19060972871, - 1.1863995523, - 1.18218219324, - 1.17795753925, - 1.17372547654, - 1.1694858898, - 1.16523866214, - 1.16098367505, - 1.15672080841, - 1.15244994035, - 1.14817094732, - 1.14388370397, - 1.13958808311, - 1.13528395573, - 1.13097119086, - 1.12664965559, - 1.12231921498, - 1.11797973205, - 1.11363106767, - 1.10927308055, - 1.10490562717, - 1.10052856171, - 1.09614173601, - 1.0917449995, - 1.08733819911, - 1.08292117925, - 1.07849378171, - 1.07405584559, - 1.06960720723, - 1.06514770014, - 1.06067715494, - 1.05619539922, - 1.05170225751, - 1.0471975512, - 1.04268109838, - 1.03815271383, - 1.03361220887, - 1.0290593913, - 1.02449406524, - 1.01991603108, - 1.01532508534, - 1.01072102057, - 1.00610362521, - 1.00147268347, - 0.996827975242, - 0.992169275896, - 0.987496356195, - 0.982808982133, - 0.978106914785, - 0.97338991015, - 0.968657718991, - 0.963910086669, - 0.959146752958, - 0.954367451873, - 0.949571911472, - 0.944759853658, - 0.939930993977, - 0.935085041394, - 0.930221698074, - 0.925340659145, - 0.92044161245, - 0.915524238294, - 0.910588209172, - 0.90563318949, - 0.900658835274, - 0.895664793858, - 0.890650703567, - 0.885616193378, - 0.880560882567, - 0.875484380338, - 0.870386285438, - 0.865266185744, - 0.860123657842, - 0.85495826657, - 0.849769564549, - 0.844557091685, - 0.839320374645, - 0.834058926305, - 0.828772245171, - 0.823459814764, - 0.818121102971, - 0.812755561369, - 0.807362624497, - 0.801941709099, - 0.796492213312, - 0.791013515815, - 0.785504974922, - 0.779965927625, - 0.774395688573, - 0.768793548991, - 0.763158775534, - 0.757490609058, - 0.751788263325, - 0.746050923609, - 0.740277745226, - 0.734467851945, - 0.728620334305, - 0.722734247813, - 0.716808611006, - 0.71084240338, - 0.704834563173, - 0.698783984968, - 0.692689517134, - 0.686549959055, - 0.680364058153, - 0.674130506667, - 0.667847938179, - 0.661514923845, - 0.655129968321, - 0.648691505328, - 0.642197892843, - 0.635647407856, - 0.629038240649, - 0.622368488555, - 0.615636149122, - 0.608839112616, - 0.601975153792, - 0.595041922828, - 0.588036935332, - 0.580957561292, - 0.573801012834, - 0.566564330621, - 0.559244368719, - 0.551837777695, - 0.5443409857, - 0.536750177229, - 0.529061269207, - 0.521269883971, - 0.513371318642, - 0.505360510284, - 0.497231996116, - 0.488979867887, - 0.480597719349, - 0.472078585477, - 0.463414871834, - 0.454598272016, - 0.445619670653, - 0.436469028735, - 0.427135247172, - 0.417606003308, - 0.407867553538, - 0.397904493027, - 0.387699460556, - 0.377232772351, - 0.366481962841, - 0.35542120169, - 0.344020543749, - 0.332244949422, - 0.320052983223, - 0.307395051085, - 0.294210959392, - 0.280426446602, - 0.265948103743, - 0.250655662336, - 0.234389761501, - 0.21693146054, - 0.1979654592, - 0.177007686288, - 0.153243009496, - 0.125081523593, - 0.0884171452144, - 0.0 -}; - const static float atanLookupTable[] { -1.52083793107, diff --git a/src/common/tpt-math.cpp b/src/common/tpt-math.cpp index d2a2e3c81..5d3b3dc11 100644 --- a/src/common/tpt-math.cpp +++ b/src/common/tpt-math.cpp @@ -1,6 +1,12 @@ #include #include "TrigTables.h" +/** + * Fast trig functions, using lookup table + * Only use for things that require no accuracy, like cyclone tool + * Do not use for any core simulation stuff + */ + float orig_atan(float val) { return atan(val); @@ -48,28 +54,6 @@ float tan(float angle) return tanLookupTable[i]; } -float asin(float angle) -{ - angle *= 81.4873; - if (angle > 256 || angle < 0) - { - return 0.0; - } - - return asinLookupTable[(int)(angle + 256)]; -} - -float acos(float angle) -{ - angle *= 81.4873; - if (angle > 256 || angle < 0) - { - return 0.0; - } - - return acosLookupTable[(int)(angle + 256)]; -} - float atan(float ratio) { if (ratio > 20)