Пример #1
0
        public void TestVerticesIsConvex1()
        {
            KVertices rect = new KVertices
            {
                new KVector2(0, 1),
                new KVector2(1, 1),
                new KVector2(1, 0),
                new KVector2(0, 0)
            };

            Assert.AreEqual(true, rect.IsConvex());
        }
Пример #2
0
        public void TestVerticesIsConvex2()
        {
            KVertices poly = new KVertices
            {
                new KVector2(0, 1),
                new KVector2(0.5f, 0.5f),
                new KVector2(1, 1),
                new KVector2(1, 0),
                new KVector2(0, 0)
            };

            Assert.AreEqual(false, poly.IsConvex());
        }
Пример #3
0
        public void TestVerticesIsConvex3()
        {
            KVertices poly = new KVertices
            {
                new KVector2(0, 0),
                new KVector2(0f, 1f),
                new KVector2(1, 1),
                new KVector2(1.5f, 1.5f),
                new KVector2(1, 1),
                new KVector2(1, 0)
            };

            Assert.AreEqual(false, poly.IsConvex());
            Assert.AreEqual(4, poly.Count);
        }