Ejemplo n.º 1
0
        private void FillPolygonCore(int id, Color color, PointF[] points)
        {
            for (var i = 1; i < points.Length; i++)
            {
                edges.Add(new Edge(id, points[i - 1], points[i], color));
            }

            // Close polygon
            if (points[0].X != points[points.Length - 1].X ||
                points[0].Y != points[points.Length - 1].Y)
            {
                edges.Add(new Edge(id, points[points.Length - 1], points[0], color));
            }
        }
Ejemplo n.º 2
0
        public void EdgeTable_Diagonal()
        {
            var table = new EdgeTable(10, 10);

            table.Add(new Edge(1, new PointF(0, 0), new PointF(10, 5), Color.Red));

            var edges = table[0];

            Assert.AreEqual(1, edges.Count);
            Assert.AreEqual(0, edges[0].FromX);
            Assert.AreEqual(2, edges[0].Width);
        }
Ejemplo n.º 3
0
        public void EdgeTable_VerticalAligned()
        {
            var table = new EdgeTable(10, 10);

            table.Add(new Edge(1, new PointF(2f, 0), new PointF(2f, 10), Color.Red));

            var edges = table[5];

            Assert.AreEqual(1, edges.Count);
            Assert.AreEqual(2, edges[0].FromX);
            Assert.AreEqual(0, edges[0].Width);
        }