AcTools.Tests.LutTest.CubicInterpolation C# (CSharp) Method

CubicInterpolation() private method

private CubicInterpolation ( ) : void
return void
        public void CubicInterpolation() {
            var lut = new Lut {
                new LutPoint(1d, 1d),
                new LutPoint(2d, 1d),
                new LutPoint(4d, 5d),
                new LutPoint(5d, 3d),
            };

            // points
            Assert.AreEqual(1d, lut.InterpolateCubic(1d));
            Assert.AreEqual(1d, lut.InterpolateCubic(2d));
            Assert.AreEqual(3d, lut.InterpolateCubic(5d));

            // clamping
            Assert.AreEqual(1d, lut.InterpolateCubic(-1d));
            Assert.AreEqual(3d, lut.InterpolateCubic(5.7d));

            // interpolation itself
            Assert.IsTrue(lut.InterpolateCubic(1.9d) < 1d);
        }