Ejemplo n.º 1
0
        public void DrawFullCarcass()
        {
            Wb.Clear();

            ////Z - buffer
            //int[,] Z = new int[Wb.PixelWidth, Wb.PixelHeight];
            //for (int i = 0; i < Wb.PixelWidth; i++)
            //{
            //    for (int j = 0; j < Wb.PixelHeight; j++)
            //    {
            //        Z[i, j] = Int32.MinValue;
            //    }
            //}
            Point[] buffer = new Point[(BetaDo - BetaOt)];
            for (int alfa = AlfaOt; alfa < AlfaDo; alfa += resolution)
            {
                for (int beta = BetaOt; beta < BetaDo; beta += resolution * 2)
                {
                    var res = MainModel.Axonometry(MainModel.Func(R, alfa * Math.PI / 180, beta * Math.PI / 180),
                                                   Alfa * Math.PI / 180,
                                                   Beta * Math.PI / 180);
                    if (!double.IsNegativeInfinity(pointHorizontal.X))
                    {
                        MainModel.Line(wb, (int)pointHorizontal.X, (int)pointHorizontal.Y,
                                       (int)res.Item1 + Wb.PixelWidth / 2, (int)res.Item2 + Wb.PixelHeight / 2,
                                       color);// ,ref Z, (int)res.Item3);
                        if (alfa > 0)
                        {
                            MainModel.Line(wb, (int)buffer[beta].X, (int)buffer[beta].Y,
                                           (int)res.Item1 + Wb.PixelWidth / 2, (int)res.Item2 + Wb.PixelHeight / 2,
                                           color);
                        }
                    }
                    buffer[beta] = new Point(res.Item1 + Wb.PixelWidth / 2, res.Item2 + Wb.PixelHeight / 2);
                    if (alfa < AlfaDo - resolution)
                    {
                        pointHorizontal = new Point(res.Item1 + Wb.PixelWidth / 2, res.Item2 + Wb.PixelHeight / 2);
                    }
                    else
                    {
                        pointHorizontal.X = double.NegativeInfinity;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void DrawHorizontalCarcass(Func <Tuple <double, double, double>, int, Tuple <double, double, double> > scaling,
                                          Func <Tuple <double, double, double>, int, int, int, Tuple <double, double, double> > moving,
                                          Func <Tuple <double, double, double>, int, Tuple <double, double, double> > rX,
                                          Func <Tuple <double, double, double>, int, Tuple <double, double, double> > rY,
                                          Func <Tuple <double, double, double>, int, Tuple <double, double, double> > rZ)
        {
            Wb.Clear();

            ////Z - buffer
            //int[,] Z = new int[Wb.PixelWidth, Wb.PixelHeight];
            //for (int i = 0; i < Wb.PixelWidth; i++)
            //{
            //    for (int j = 0; j < Wb.PixelHeight; j++)
            //    {
            //        Z[i, j] = Int32.MinValue;
            //    }
            //}
            for (int alfa = AlfaOt; alfa < AlfaDo; alfa += resolution)
            {
                for (int beta = BetaOt; beta < BetaDo; beta += resolution * 2)
                {
                    var res = MainModel.Axonometry(rZ(rY(rX(moving(scaling(MainModel.Func(R, alfa * Math.PI / 180, beta * Math.PI / 180), K), Dx, Dy, Dz), AffineAngleX), AffineAngleY), AffineAngleZ),
                                                   Alfa * Math.PI / 180,
                                                   Beta * Math.PI / 180);
                    if (!double.IsNegativeInfinity(pointHorizontal.X))
                    {
                        MainModel.Line(wb, (int)pointHorizontal.X, (int)pointHorizontal.Y,
                                       (int)res.Item1 + Wb.PixelWidth / 2, (int)res.Item2 + Wb.PixelHeight / 2,
                                       color);//,ref Z, (int)res.Item3);
                    }
                    if (alfa < AlfaDo - resolution)
                    {
                        pointHorizontal = new Point(res.Item1 + Wb.PixelWidth / 2, res.Item2 + Wb.PixelHeight / 2);
                    }
                    else
                    {
                        pointHorizontal.X = double.NegativeInfinity;
                    }
                }
            }
        }
Ejemplo n.º 3
0
 public void DrawPolygons()
 {
     Wb.Clear();
     Point[] bufferUp   = new Point[(BetaDo - BetaOt)];
     Point[] bufferDown = new Point[(BetaDo - BetaOt)];
     for (int alfa = AlfaOt; alfa < AlfaDo; alfa += resolution)
     {
         for (int beta = BetaOt; beta < BetaDo; beta += resolution)
         {
             var res = MainModel.Axonometry(MainModel.Func(R, alfa * Math.PI / 180, beta * Math.PI / 180),
                                            Alfa * Math.PI / 180,
                                            Beta * Math.PI / 180);
             bufferDown[beta] = new Point(res.Item1 + Wb.PixelWidth / 2, res.Item2 + Wb.PixelHeight / 2);
             if (alfa > 1 && beta > 0)
             {
                 MainModel.Polygon(wb, bufferUp[beta - 1], bufferUp[beta], bufferDown[beta - 1], bufferDown[beta], color);
             }
             if (alfa > 0 && beta > 0)
             {
                 bufferUp[beta - 1] = bufferDown[beta - 1];
             }
         }
     }
 }