Ejemplo n.º 1
0
        public static void ShowCurve( 
            string caption,
            EdgeArrayArray eaa,
            AnalyticalDirection dropCoordinate)
        {
            float width = 400;
              float height = 400;
              Bitmap bmp = new Bitmap( (int) width, (int) height );
              //List<PointF[]> pointcurve = Make2DCurvesFromXYZ3DDataJustDroppingZ( curves );
              List<PointF[]> pointLoops = GetPointLoops( eaa, dropCoordinate );
              float origox = 0;
              float origoy = 0;
              float scalex = 1;
              float scaley = 1;
              float translatex = 0;
              float translatey = 0;
              SizeF fwantedsize = new SizeF( width, height );
              FinnMinMaxSkaleringOrigo( pointLoops, fwantedsize, ref origox, ref origoy, ref scalex, ref scaley, ref translatex, ref translatey, out width, out height, false );
              Graphics gr = Graphics.FromImage( bmp );
              DrawCurvesOnGraphics( gr, bmp.Size, pointLoops, true, translatex, translatey, scalex, scaley, System.Drawing.Color.Black, 1 );

              PictureBox pb = new PictureBox();
              pb.Image = bmp;
              pb.Size = bmp.Size;
              System.Windows.Forms.Form form = new System.Windows.Forms.Form();
              form.Size = new Size( bmp.Width + 10, bmp.Height + 10 );
              form.Text = caption;
              pb.Parent = form;
              pb.Location = new System.Drawing.Point( 0, 0 );
              form.Show();
        }
Ejemplo n.º 2
0
        static List<PointF[]> GetPointLoops(
            EdgeArrayArray eaa,
            AnalyticalDirection dropCoordinate)
        {
            int n = eaa.Size;

              List<PointF[]> loops = new List<PointF[]>( n );

              foreach( EdgeArray ea in eaa )
              {
            PointF[] loop = new PointF[ea.Size + 1];

            int i = 0;
            XYZ p0 = null;

            foreach( Edge e in ea )
            {
              XYZ p = e.AsCurve().GetEndPoint( 0 );
              loop[i] = GetPointF( p, dropCoordinate );
              if( null == p0 ) { p0 = p; }
              ++i;
            }
            loop[i] = GetPointF( p0, dropCoordinate );
            loops.Add( loop );
              }
              return loops;
        }
Ejemplo n.º 3
0
        static PointF GetPointF( XYZ p,
            AnalyticalDirection dropCoordinate)
        {
            if( AnalyticalDirection.X == dropCoordinate )
              {
            return new PointF( (float) p.Y, (float) p.Z );
              }
              else if( AnalyticalDirection.Y == dropCoordinate )
              {
            return new PointF( (float) p.X, (float) p.Z );
              }
              else
              {
            Debug.Assert(
              AnalyticalDirection.Z == dropCoordinate,
              "expected X, Y or Z" );

            return new PointF( (float) p.X, (float) p.Y );
              }
        }