Abacus.SinglePrecision.Vector4Tests.TestStaticFn_Hermite_iii C# (CSharp) Method

TestStaticFn_Hermite_iii() private method

private TestStaticFn_Hermite_iii ( ) : void
return void
        public void TestStaticFn_Hermite_iii ()
        {
            var a = new Vector4( -100, +50, +100, -50 );
            var b = new Vector4( +100, -50, -100, +50 );

            var c = new Vector4( -10, +5, +10, -5 );
            var d = new Vector4( +10, -5, -10, +5 );

            Vector4 an; Vector4.Normalise(ref c, out an);
            Vector4 bn; Vector4.Normalise(ref d, out bn);

            Single one = 1;

            // 100.1953125
            Single e = (Single) 51300 / (Single) 512;

            // 50.09765625
            Single f = (Single) 12825 / (Single) 256;

            // 91.25
            Single g = (Single) 365 / (Single) 4;

            // 45.625
            Single h = (Single) 365 / (Single) 8;

            // 75.7421875
            Single i = (Single) 9695 / (Single) 128;

            // 37.87109375
            Single j = (Single) 9695 / (Single) 256;

            // 56.25
            Single k = (Single) 225 / (Single) 4;

            // 28.125
            Single l = (Single) 225 / (Single) 8;

            // 35.3515625
            Single m = (Single) 4525 / (Single) 128;

            // 17.67578125
            Single n = (Single) 4525 / (Single) 256;

            // 15.625
            Single o = (Single) 125 / (Single) 8;

            // 7.8125
            Single p = (Single) 125 / (Single) 16;

            // 0.3515625
            Single q = (Single) 45 / (Single) 128;

            // 0.17578125
            Single r = (Single) 45 / (Single) 256;

            Single a0 = 0;
            Single a1 = (one * 1) / 8;
            Single a2 = (one * 2) / 8;
            Single a3 = (one * 3) / 8;
            Single a4 = (one * 4) / 8;
            Single a5 = (one * 5) / 8;
            Single a6 = (one * 6) / 8;
            Single a7 = (one * 7) / 8;
            Single a8 = 1;

            Vector4 r0 = b;
            Vector4 r1 = new Vector4(  e, -f, -e,  f );
            Vector4 r2 = new Vector4(  g, -h, -g,  h );
            Vector4 r3 = new Vector4(  i, -j, -i,  j );
            Vector4 r4 = new Vector4(  k, -l, -k,  l );
            Vector4 r5 = new Vector4(  m, -n, -m,  n );
            Vector4 r6 = new Vector4(  o, -p, -o,  p );
            Vector4 r7 = new Vector4( -q,  r,  q, -r );
            Vector4 r8 = c;

            var knownResults = new List<Tuple<Single, Vector4>>
            {
                new Tuple<Single, Vector4>( a0, r0 ),
                new Tuple<Single, Vector4>( a1, r1 ),
                new Tuple<Single, Vector4>( a2, r2 ),
                new Tuple<Single, Vector4>( a3, r3 ),
                new Tuple<Single, Vector4>( a4, r4 ),
                new Tuple<Single, Vector4>( a5, r5 ),
                new Tuple<Single, Vector4>( a6, r6 ),
                new Tuple<Single, Vector4>( a7, r7 ),
                new Tuple<Single, Vector4>( a8, r8 ),
            };

            for (Int32 idx = 0; idx < knownResults.Count; ++idx)
            {
                Vector4 result;
                Single amount = knownResults[idx].Item1;
                Vector4 expected = knownResults[idx].Item2;

                Vector4.CatmullRom (
                    ref a, ref b, ref c, ref d, ref amount, out result);

                AssertEqualWithinReason(result, expected);
            }
        }
Vector4Tests