예제 #1
0
        public void Assigning_a_transformation()
        {
            var pattern = new TestPattern();

            pattern.Transform = Transformation.Translation(1, 2, 3);
            Assert.AreEqual(Transformation.Translation(1, 2, 3), pattern.Transform);
        }
예제 #2
0
        public void Stripes_with_a_pattern_transformation()
        {
            var sphere  = Sphere.UnitSphere();
            var pattern = new TestPattern();

            pattern.Transform = Transformation.Scaling(2, 2, 2);
            var color = pattern.PatternColorAtShape(sphere, Tuple.Point(2, 3, 4));

            Assert.AreEqual(new Color(1, 1.5, 2), color);
        }
예제 #3
0
        public void Stripes_with_both_an_object_and_a_pattern_transformation()
        {
            var sphere = Sphere.UnitSphere();

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

            pattern.Transform = Transformation.Translation(0.5, 1, 1.5);
            var color = pattern.PatternColorAtShape(sphere, Tuple.Point(2.5, 3, 3.5));

            Assert.AreEqual(new Color(0.75, 0.5, 0.25), color);
        }
예제 #4
0
        public void Group_and_object_and_pattern_transformation()
        {
            var group = new Group();

            group.Transform = Transformation.Translation(1, 0, 0);

            var sphere = Sphere.UnitSphere();

            sphere.Transform = Transformation.Scaling(2, 2, 2);
            group.AddChild(sphere);

            var pattern = new TestPattern();

            pattern.Transform = Transformation.Translation(1, 0, 0);

            var color = pattern.PatternColorAtShape(sphere, Tuple.Point(3, 0, 0));

            Assert.AreEqual(new Color(0, 0, 0), color);
        }
예제 #5
0
        public void The_default_pattern_transformation()
        {
            var pattern = new TestPattern();

            Assert.AreEqual(Transformation.Identity, pattern.Transform);
        }