Beispiel #1
0
        public void StripedPatternZConst()
        {
            Pattern pattern = new StripedPattern(white, black);

            Assert.AreEqual(pattern.PatternAt(Tuple.Point(0, 0, 0)), white);
            Assert.AreEqual(pattern.PatternAt(Tuple.Point(0, 0, 1)), white);
            Assert.AreEqual(pattern.PatternAt(Tuple.Point(0, 0, 2)), white);
        }
Beispiel #2
0
        public void StripePatternConstantZ()
        {
            Pattern black = new SolidPattern(Color.Black);
            Pattern white = new SolidPattern(Color.White);

            StripedPattern pattern = new StripedPattern(white, black);

            Assert.True(Color.White == pattern.PatternAt(new Point(0, 0, 0)));
            Assert.True(Color.White == pattern.PatternAt(new Point(0, 0, 1)));
            Assert.True(Color.White == pattern.PatternAt(new Point(0, 0, 2)));
        }
Beispiel #3
0
        public void StripedPatternXChanges()
        {
            Pattern pattern = new StripedPattern(white, black);

            Assert.AreEqual(pattern.PatternAt(Tuple.Point(0, 0, 0)), white);
            Assert.AreEqual(pattern.PatternAt(Tuple.Point(0.9, 0, 0)), white);
            Assert.AreEqual(pattern.PatternAt(Tuple.Point(1, 0, 0)), black);
            Assert.AreEqual(pattern.PatternAt(Tuple.Point(-0.1, 0, 0)), black);
            Assert.AreEqual(pattern.PatternAt(Tuple.Point(-1, 0, 0)), black);
            Assert.AreEqual(pattern.PatternAt(Tuple.Point(-1.1, 0, 0)), white);
        }
Beispiel #4
0
        public void StripePatternAlternatesX()
        {
            Pattern black = new SolidPattern(Color.Black);
            Pattern white = new SolidPattern(Color.White);

            StripedPattern pattern = new StripedPattern(white, black);

            Assert.True(Color.White == pattern.PatternAt(new Point(0, 0, 0)));
            Assert.True(Color.White == pattern.PatternAt(new Point(0.9f, 0, 0)));
            Assert.True(Color.Black == pattern.PatternAt(new Point(1, 0, 0)));
            Assert.True(Color.Black == pattern.PatternAt(new Point(-0.1f, 0, 0)));
            Assert.True(Color.Black == pattern.PatternAt(new Point(-1, 0, 0)));
            Assert.True(Color.White == pattern.PatternAt(new Point(-1.1f, 0, 0)));
        }