Beispiel #1
0
        public Plot2D Project(Plot3D p)
        {
            Plot2D plot2D = new Plot2D {
                LinesH = p.LinesH, LinesV = p.LinesV, Size = p.Size
            };

            foreach (PPoint3D point in p.GetPoints())
            {
                var num = (float)Math.Sqrt(point.SquareLen());
                plot2D.AddPoint(new PPoint2D(point.X / num, point.Y / num, point.Color, point.Visible));
            }
            return(plot2D);
        }
Beispiel #2
0
        public Plot2D Project(Plot3D p)
        {
            Plot2D plot2D = new Plot2D {
                LinesH = p.LinesH, LinesV = p.LinesV, Size = p.Size
            };

            foreach (PPoint3D point in p.GetPoints())
            {
                plot2D.AddPoint(new PPoint2D(point.X * _ez / point.Z, point.Y * _ez / point.Z, point.Color,
                                             point.Visible));
            }
            return(plot2D);
        }
Beispiel #3
0
        public Plot2D UnProject(Plot3D p)
        {
            Plot2D plot2D = new Plot2D {
                LinesH = p.LinesH, LinesV = p.LinesV, Size = p.Size
            };

            foreach (PPoint3D point in p.GetPoints())
            {
                PPoint3D ppoint3D = point;
                plot2D.AddPoint(new PPoint2D(ppoint3D.X / (1f - ppoint3D.Z), ppoint3D.Y / (1f - ppoint3D.Z),
                                             point.Color == Color.Empty
                        ? Extensions.HsvToRgb(360.0 * (point.Z - (double)p.MinZ) / (p.MaxZ - (double)p.MinZ), 1.0, 1.0)
                        : point.Color, point.Visible));
            }
            return(plot2D);
        }