示例#1
0
        private void panel1_Paint(object sender, PaintEventArgs e)
        {
            var grafics = e.Graphics;
            var pen     = new Pen(Color.Black);

            System.Drawing.Point invisible;

            var points = _house.GetBox(50, panel1.Width / 2, panel1.Height / 2, out invisible, debug);

            var index = Array.IndexOf(points, invisible);

            label1.Text = index.ToString();

            for (int i = 0; i < debug.Count; i++)
            {
                debug[i].Text = String.Format("X: {0} Y: {1} {2}", points[i].X, points[i].Y, debug[i].Text);
            }

            var planes = new List <List <int> >()
            {
                new List <int>()
                {
                    0, 2, 6, 4
                },
                new List <int>()
                {
                    4, 5, 7, 6
                },
                new List <int>()
                {
                    2, 3, 7, 6
                },
                new List <int>()
                {
                    0, 1, 3, 2
                },
                new List <int>()
                {
                    0, 1, 5, 4
                },
                new List <int>()
                {
                    1, 5, 7, 3
                },

                new List <int>()
                {
                    0, 8, 9, 1
                },
                new List <int>()
                {
                    4, 8, 9, 5
                }
            };

            foreach (var plane in planes)
            {
                var draw = ProjectionTool.GetPoints(points, plane.ToArray());
                //if (!draw.Contains(invisible))
                grafics.DrawPolygon(pen, draw);
            }
        }