示例#1
0
        private void boxPlotterRendered(Shapes.BoundingBox box, double rot_x, double rot_y, double rot_z, double width, double height, double length, p3D.Point3D center)
        {
            string[]  seriesNames = boxSeriesNames(box);
            Point3D[] polarity    = boxCornerPolarities();
            double    inc         = 300;

            double[] dimensions = { width, height, length };
            int[]    sides      = { 5, 0, 4 };
            Point3D  dir0       = new Point3D(1, 0, 0);
            Point3D  dir1       = new Point3D(0, 1, 0);
            Point3D  dir2       = new Point3D(0, 0, 1);

            Point3D[] incDirection = { dir0, dir1, dir2 };
            for (int i = 0; i < 3; i++)
            {
                int[] sidePoints = boxSidePoints(sides[i]);
                for (double j = 0; j < dimensions[i]; j = j + dimensions[i] / inc)
                {
                    for (int k = 0; k < 5; k++)
                    {
                        Convert3DTo2D(rot_x, rot_y, rot_z, width / 2 * polarity[sidePoints[k]].X + center.X + j * incDirection[i].X, height / 2 * polarity[sidePoints[k]].Y + center.Y + j * incDirection[i].Y,
                                      length / 2 * polarity[sidePoints[k]].Z + center.Z + j * incDirection[i].Z, ref x, ref y, ref z);
                        chart.Series[seriesNames[sides[i]]].Points.AddXY(x, y);
                    }
                }
            }
        }
示例#2
0
 public void deleteShape(Shapes.BoundingBox box)
 {
     string[] seriesNames = boxSeriesNames(box);
     foreach (string name in seriesNames)
     {
         Series series = chart.Series[name];
         chart.Series.Remove(series);
     }
 }
示例#3
0
 public void plotSetup(Shapes.BoundingBox box, System.Drawing.Color color)
 {
     string[] seriesNames = boxSeriesNames(box);
     foreach (string name in seriesNames)
     {
         chart.Series.Add(name);
         chart.Series[name].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
         chart.Series[name].Color     = color;
     }
 }
示例#4
0
        private string[] boxSeriesNames(Shapes.BoundingBox box)
        {
            string Face0 = String.Format("boxFace0_{0}", box.Name);
            string Face1 = String.Format("boxFace1_{0}", box.Name);
            string Face2 = String.Format("boxFace2_{0}", box.Name);
            string Face3 = String.Format("boxFace3_{0}", box.Name);
            string Face4 = String.Format("boxFace4_{0}", box.Name);
            string Face5 = String.Format("boxFace5_{0}", box.Name);

            string[] series = { Face0, Face1, Face2, Face3, Face4, Face5 };
            return(series);
        }
示例#5
0
 public void Plot(Shapes.BoundingBox box, p3D.Point3D center, double rot_x, double rot_y, double rot_z, bool rendered)
 {
     string[] seriesNames = boxSeriesNames(box);
     foreach (string name in seriesNames)
     {
         chart.Series[name].Points.Clear();
     }
     if (rendered)
     {
         boxPlotterRendered(box, rot_x, rot_y, rot_z, box.Width, box.Height, box.Length, center);
     }
     else
     {
         boxPlotterWire(box, rot_x, rot_y, rot_z, box.Width, box.Height, box.Length, center);
     }
     chartSizer(chart);
 }
示例#6
0
        private void boxPlotterWire(Shapes.BoundingBox box, double rot_x, double rot_y, double rot_z, double width, double height, double length, p3D.Point3D center)
        {
            string[]         seriesNames = boxSeriesNames(box);
            Point3D[]        polarity    = boxCornerPolarities();
            List <DataPoint> points      = new List <DataPoint>();

            for (int i = 0; i < 8; i++)
            {
                Convert3DTo2D(rot_x, rot_y, rot_z, width / 2 * polarity[i].X + center.X, height / 2 * polarity[i].Y + center.Y, length / 2 * polarity[i].Z + center.Z, ref x, ref y, ref z);
                DataPoint point = new DataPoint(x, y);
                points.Add(point);
            }
            for (int i = 0; i < 6; i++)
            {
                int[] point = boxSidePoints(i);
                for (int j = 0; j < 5; j++)
                {
                    chart.Series[seriesNames[i]].Points.Add(points[point[j]]);
                }
            }
        }