Example #1
0
        protected static FixedNumber GetSinTab(FixedNumber r)
        {
            FixedNumber i = new FixedNumber(r.ToInt());

            //UnityEngine.Debug.Log(i.ToInt());
            if (i.ToInt() == _m_SinTab.Count - 1)
            {
                return(_m_SinTab[(int)i.ToInt()]);
            }
            else
            {
                // UnityEngine.Debug.Log(i.ToInt()+":"+ _m_SinTab[i.ToInt()]+":"+ Ratio.Lerp(_m_SinTab[i.ToInt()], _m_SinTab[(i + 1).ToInt()], r - i));
                return(FixedNumber.Lerp(_m_SinTab[(int)i.ToInt()], _m_SinTab[(int)(i + 1).ToInt()], r - i));
            }
        }
Example #2
0
        public static FixedNumber GetAsinTab(FixedNumber sin)
        {
            MathFixed math = Instance;

            //UnityEngine.Debug.Log("GetAsinTab");
            for (int i = _m_SinTab.Count - 1; i >= 0; i--)
            {
                if (sin > _m_SinTab[i])
                {
                    if (i == _m_SinTab.Count - 1)
                    {
                        return(new FixedNumber(i) / (tabCount / 4) * (PI / 2));
                    }
                    else
                    {
                        //return new Ratio(i);
                        return(FixedNumber.Lerp(new FixedNumber(i), new FixedNumber(i + 1), (sin - _m_SinTab[i]) / (_m_SinTab[i + 1] - _m_SinTab[i])) / (tabCount / 4) * (PI / 2));
                    }
                }
            }
            return(new FixedNumber());
        }