Exemple #1
0
        public void T11_ConeNormal()
        {
            Cone cone = new Cone();

            Point[] p = new Point[3];
            p[0] = new Point(0, 0, 0);
            p[1] = new Point(1, 1, 1);
            p[2] = new Point(-1, -1, 0);

            Vector[] n = new Vector[3];
            n[0] = new Vector(0, 0, 0);
            n[1] = new Vector(1, -Math.Sqrt(2), 1);
            n[2] = new Vector(-1, 1, 0);
            n[0].Normalize();
            n[1].Normalize();
            n[2].Normalize();
            //Stupid vectors in  the book aren't normalized ;-p

            Assert.AreEqual(n[0], cone.GetNormal(p[0]));
            Assert.AreEqual(n[1], cone.GetNormal(p[1]));
            Assert.AreEqual(n[2], cone.GetNormal(p[2]));
        }