Beispiel #1
0
        void Start()
        {
            points = new Vector2f[100];
            FillWithRandom(points);

            convex = ConvexHull2.FindHull(points);
            convex.BuildIndices();
        }
Beispiel #2
0
        public void FindHull()
        {
            Vector2f[] points = new Vector2f[]
            {
                new Vector2f(0, 0),
                new Vector2f(10, 0),
                new Vector2f(10, 10),
                new Vector2f(6, 5),
                new Vector2f(4, 1)
            };

            Polygon2f convex = ConvexHull2.FindHull(points);

            Assert.AreEqual(3, convex.VerticesCount);
            Assert.AreEqual(points[0], convex.Positions[0]);
            Assert.AreEqual(points[1], convex.Positions[1]);
            Assert.AreEqual(points[2], convex.Positions[2]);
            Assert.IsTrue(ConvexHull2.IsStronglyConvex(convex.Positions, convex.IsCCW));
        }