Esempio n. 1
0
        public void AreaTest()
        {
            ITask  t = geometry;
            double r = geometry.Area(X, Y);

            Assert.AreEqual(36, Math.Round(r));
        }
        public void TestComputingPolygonArea()
        {
            Console.WriteLine($"========== 도형의 넓이 구하기 ===========");
            double boxArea = Geometry2D.Area(new[]
            {
                new Vector2(0, 0),
                new Vector2(10, 0),
                new Vector2(10, 10),
                new Vector2(0, 10)
            });

            Console.WriteLine($"사각형의 넓이(가로:{10},세로:{10}) , {boxArea}");

            double triArea = Geometry2D.Area(new[]
            {
                new Vector2(0, 0),
                new Vector2(10, 0),
                new Vector2(5, 10)
            });

            Console.WriteLine($"삼각형의 넓이(가로:{10},세로:{10}) , {triArea}");
            Console.WriteLine($"===========================================");
        }