Beispiel #1
0
        public void AssignTransform()
        {
            var p = new TestPattern {
                Transform = Translation(1f, 2f, 3f)
            };

            Assert.That.MatricesAreEqual(p.Transform.Matrix, Translation(1f, 2f, 3f));
        }
Beispiel #2
0
        public void PatternWithObjectTransform()
        {
            var p = new TestPattern();
            var s = new Sphere(Scale(2f));
            var c = p.ColorAtEntity(s, Point(2f, 3f, 4f));

            Assert.That.VectorsAreEqual(c, new Color(1f, 1.5f, 2f));
        }
Beispiel #3
0
        public void PatternWithBothTransformed()
        {
            var p = new TestPattern {
                Transform = Translation(.5f, 1f, 1.5f)
            };
            var s = new Sphere(Scale(2f));
            var c = p.ColorAtEntity(s, Point(2.5f, 3f, 3.5f));

            Assert.That.VectorsAreEqual(c, new Color(.75f, .5f, .25f));
        }
Beispiel #4
0
        public void StripesWithPatternTransform_ShouldWork()
        {
            var shape   = new Sphere();
            var pattern = new TestPattern();

            pattern.Transform = Transformation.Scaling(2, 2, 2);
            var c = pattern.PatternAtShape(shape, new Point(2, 3, 4));

            Assert.Equal(new Color(1, 1.5, 2), c);
        }
Beispiel #5
0
        public void StripesWithBothObjectAndPatternTransforms_ShouldWork()
        {
            var shape = new Sphere();

            shape.Transform = Transformation.Scaling(2, 2, 2);
            var pattern = new TestPattern();

            pattern.Transform = Transformation.Translation(0.5, 1, 1.5);
            var c = pattern.PatternAtShape(shape, new Point(2.5, 3, 3.5));

            Assert.Equal(new Color(0.75, 0.5, 0.25), c);
        }
Beispiel #6
0
        public void PatternTransform()
        {
            var p = new TestPattern();

            Assert.That.MatricesAreEqual(p.Transform, Transform.Identity);
        }