Exemple #1
0
        public void ComputingTheNormalVectorOnCone()
        {
            var shape = new Cone();
            var cases = new[]
            {
                new
                {
                    point  = Vector4.CreatePosition(0, 0, 0),
                    normal = Vector4.CreateDirection(0, 0, 0),
                },
                new
                {
                    point  = Vector4.CreatePosition(1, 1, 1),
                    normal = Vector4.CreateDirection(1, -Math.Sqrt(2), 1),
                },
                new
                {
                    point  = Vector4.CreatePosition(-1, -1, 0),
                    normal = Vector4.CreateDirection(-1, 1, 0),
                }
            };

            foreach (var c in cases)
            {
                var n = shape.GetLocalNormal(c.point);
                Assert.Equal(c.normal, n);
            }
        }