Exemplo n.º 1
0
        private Polygon[] FindAllIntersectionPolygons()
        {
            List <Polygon> returnList = new List <Polygon>();

            foreach (var subject in DrawnFigureList)
            {
                foreach (var clipping in RandomFigureList)
                {
                    returnList.AddRange(WeilerAtherton.PerformAlgorithm(subject as Polygon, clipping as Polygon));
                }
            }
            return(returnList.ToArray());
        }
Exemplo n.º 2
0
        private void MainWindow_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
        {
            switch (e.Key)
            {
            case Key.D:
                foreach (var fig in MarkedFigures)
                {
                    DrawnFigureList.Remove(fig);
                }
                MarkedFigures = new List <Figure>();
                RefreshAndDrawFigures();
                break;

            case Key.M:
                Polygon newRandom = Quickhull.CreateConvexPolygon(0, bottomBitmap.Width, 0, bottomBitmap.Height);
                newRandom.FillColor   = System.Drawing.Color.FromArgb(100, 255, 0, 0);
                newRandom.FillTexture = RandomFiguresFillTexture;
                newRandom.BumpMap     = RandomFiguresBumpMap;
                newRandom             = new RandomPolygon(newRandom);
                (newRandom as RandomPolygon).Speed = ReturnRandomSpeed();
                RandomFigureList.Add(newRandom);
                DrawRandomFigures();
                break;

            case Key.K:
                Polygon[] temp = WeilerAtherton.PerformAlgorithm(DrawnFigureList[0] as Polygon, DrawnFigureList[1] as Polygon);
                DrawnFigureList = new List <Figure>();
                DrawnFigureList.AddRange(temp);
                RefreshAndDrawFigures();
                break;

            case Key.Y:
                foreach (var fig in DrawnFigureList)
                {
                    fig.Fill(CurrentBitmap, LightColor, new Vector3D(XLightCoord, YLightCoord, LightHeight));
                    fig.Draw(CurrentBitmap);
                    BottomImage.Source = loadBitmap(CurrentBitmap);
                }
                break;
            }
        }