public void TestPatternTextureMapPatternWithSphericalMap() { var checkers = new CheckersPattern(16, 8, Color.Black, Color.White); var pattern = new TextureMap(checkers, Mapping.Spherical); Assert.AreEqual(pattern.PatternAt(new Point(0.4315, 0.4670, 0.7719)), Color.White); Assert.AreEqual(pattern.PatternAt(new Point(-0.9654, 0.2552, -0.0534)), Color.Black); Assert.AreEqual(pattern.PatternAt(new Point(0.1039, 0.7090, 0.6975)), Color.White); Assert.AreEqual(pattern.PatternAt(new Point(-0.4986, -0.7856, -0.3663)), Color.Black); Assert.AreEqual(pattern.PatternAt(new Point(-0.0317, -0.9395, 0.3411)), Color.Black); Assert.AreEqual(pattern.PatternAt(new Point(0.4809, -0.7721, 0.4154)), Color.Black); Assert.AreEqual(pattern.PatternAt(new Point(0.0285, -0.9612, -0.2745)), Color.Black); Assert.AreEqual(pattern.PatternAt(new Point(-0.5734, -0.2162, -0.7903)), Color.White); Assert.AreEqual(pattern.PatternAt(new Point(0.7688, -0.1470, 0.6223)), Color.Black); Assert.AreEqual(pattern.PatternAt(new Point(-0.7652, 0.2175, 0.6060)), Color.Black); }
public void MapPatternToSphere() { var c = new UVCheckers(16, 8, Colors.Black, Colors.White); var tm = new TextureMap(c, UVMapping.Spherical); tm.PatternAt(new Point(0.4315f, 0.4670f, 0.7719f)).Should().Be(Colors.White); tm.PatternAt(new Point(-0.9654f, 0.2552f, -0.0534f)).Should().Be(Colors.Black); tm.PatternAt(new Point(0.1039f, 0.7090f, 0.6975f)).Should().Be(Colors.White); tm.PatternAt(new Point(-0.4986f, -0.7856f, -0.3663f)).Should().Be(Colors.Black); tm.PatternAt(new Point(-0.0317f, -0.9395f, 0.3411f)).Should().Be(Colors.Black); tm.PatternAt(new Point(0.4809f, -0.7721f, 0.4154f)).Should().Be(Colors.Black); tm.PatternAt(new Point(0.0285f, -0.9612f, -0.2745f)).Should().Be(Colors.Black); tm.PatternAt(new Point(-0.5734f, -0.2162f, -0.7903f)).Should().Be(Colors.White); tm.PatternAt(new Point(0.7688f, -0.1470f, 0.6223f)).Should().Be(Colors.Black); tm.PatternAt(new Point(-0.7652f, 0.2175f, 0.6060f)).Should().Be(Colors.Black); }
public void TextureMapPattern_ShouldMapToSphereUsingSphereMap(Point point, Color expected) { var checkers = new UvCheckers(16, 8, Color.Black, Color.White); var pattern = new TextureMap(checkers, TextureMapper.SphericalMap); Assert.Equal(expected, pattern.PatternAt(point)); }