public void BlendZeroToOneTest(double a) { var module = new Blend { Control = new Constant { ConstantValue = a }, Source0 = new Constant { ConstantValue = 0 }, Source1 = new Constant { ConstantValue = 1 }, }; var expected = 0.5 * (a + 1); // rescale a to [0, 1] Assert.Equal(expected, module.GetValue(0, 0, 0), 12); Assert.Equal(expected, module.GetValue(10, 10, 10), 12); }
public void BlendScaledRangeTest(double a, double scale) { //var a = data[0]; //var scale = 0; var module = new Blend { Control = new Constant { ConstantValue = a }, Source0 = new Constant { ConstantValue = 0 }, Source1 = new Constant { ConstantValue = 1 * scale }, }; var expected = scale * 0.5 * (a + 1); // rescale a to [0, scale] Assert.Equal(expected, module.GetValue(0, 0, 0), 12); Assert.Equal(expected, module.GetValue(10, 10, 10), 12); }