Beispiel #1
0
        protected override void OnCreated()
        {
            base.OnCreated();
            Loca L = F.GlyphInfo[(byte)'G'].Curves;

            G = L.ToLoxy();

            (G as ITransform2d).Transform(Matrix3x3.Scale(15, 15));
        }
Beispiel #2
0
        public override void OnPaint()
        {
            BackColor = Color.White;

            switch (ActiveSnapKind)
            {
            case Snapkind.SurfaceSnapItem:     // Problem Ränder
                //if (SnappItems.Count >0)
                //{
                //    Emission = Color.Red;
                //    SnappItems[0].DrawTriangleInfo();
                //    Emission = Color.Black;
                //    return;
                //}
                CurveExtruder CurveEx = new CurveExtruder();
                CurveEx.Direction = new xyz(0, 1, 1);
                CurveEx.Height    = -1;
                CurveEx.Curve     = new Bezier(new xy(9, 0), new xy(6, 3), new xy(3, 3), new xy(0, 0));
                CurveEx.DownPlane = new Plane(new xyz(0, 0, 0), new xyz(0, 0, 1));
                CurveEx.UpPlane   = new Plane(new xyz(0, 0, 0) + CurveEx.Direction * 7, CurveEx.Direction);

                CurveEx.Paint(this);
                break;

            case Snapkind.LineSnapItem:

                drawCurve(new Line(new xy(0, 0), new xy(10, 0)));
                break;

            case Snapkind.PointSnapItem:
                drawPoint(new xyz(4, 3, 0), 0.2);

                break;

            case Snapkind.CurveSnapItem:
                Curve C = new Bezier(new xy(9, 0), new xy(6, 3), new xy(3, 3), new xy(0, 0));
                PolygonMode = PolygonMode.Line;
                Emission    = Color.Black;
                PenWidth    = 3;
                drawCurve(C);
                PolygonMode = PolygonMode.Fill;
                break;

            case Snapkind.PolyCurveSnapItem:

                Lights[0].Position = new xyzwf(-10, -10, 10, 1);
                CurveArray _Curves0 = new CurveArray();
                PolygonMode    = PolygonMode.Line;
                _Curves0.Count = 4;
                _Curves0[0]    = new Line(new xy(-3, -3), new xy(-3, 4));
                _Curves0[1]    = new Line(new xy(-3, 4), new xy(4, 4));
                _Curves0[2]    = new Line(new xy(4, 4), new xy(4, -3));
                _Curves0[3]    = new Bezier(new xy(4, -3), new xy(3, -3.5), new xy(1, -3.5), new xy(-3, -3));

                drawPolyCurve(_Curves0);

                PolygonMode = PolygonMode.Fill;
                break;

            case Snapkind.PolyPolyCurveSnapItem:
                Loca       _Loca   = new Loca();
                CurveArray Curves0 = new CurveArray();
                Curves0.Count = 4;
                Curves0[0]    = new Line(new xy(-3, -3), new xy(-3, 4));
                Curves0[1]    = new Line(new xy(-3, 4), new xy(4, 4));
                Curves0[2]    = new Line(new xy(4, 4), new xy(4, -3));
                Curves0[3]    = new Bezier(new xy(4, -3), new xy(3, -3.5), new xy(1, -3.5), new xy(-3, -3));
                _Loca.Add(Curves0);
                OpenGlDevice.CheckError();
                CurveArray Curves1 = new CurveArray();
                Curves1.Count = 4;
                Curves1[0]    = new Line(new xy(0, 0), new xy(1, 0));
                Curves1[1]    = new Line(new xy(1, 0), new xy(1, 1));
                Curves1[2]    = new Line(new xy(1, 1), new xy(0, 1));
                Curves1[3]    = new Line(new xy(0, 1), new xy(0, 0));
                _Loca.Add(Curves1);

                PolygonMode = PolygonMode.Fill;
                drawPolyPolyCurve(_Loca);

                break;

            case Snapkind.TextSnapItem:


                Font.FontSize = 4;
                xy Pos = getEnvText(Font, "Drawing 3D");
                drawText(Font, new xyz(-Pos.X / 2, 0, 0), "Drawing 3D", 2);

                break;

            case Snapkind.MeshSnapItem:

                int[]  Indices  = new int[] { 0, 1, 2 };
                xyzf[] Position = new xyzf[] { new xyzf(0, 0, 0), new xyzf(3, 5, 0), new xyzf(6, 0, 0) };
                xyzf[] Normal   = new xyzf[] { new xyzf(0, 0, 1), new xyzf(0, 0, 1), new xyzf(0, 0, 1) };
                xyf[]  Texture  = new xyf[] { new xyf(0, 0), new xyf(3, 5), new xyf(6, 0) };
                xyzf[] Colors   = new xyzf[] { new xyzf(1, 0, 0), new xyzf(0, 1, 0), new xyzf(0, 0, 1) };

                drawMesh(Indices, Position, Normal, null, Colors);
                break;

            case Snapkind.PolyLineSnapItem:

                xyArray Poly = new xyArray();

                Poly.data   = new xy[] { new xy(1, 1), new xy(3, 4), new xy(5, 4), new xy(6, 2), new xy(1, 1) };
                PolygonMode = PolygonMode.Fill;
                PenWidth    = 3;

                drawPolyLine(Poly);
                PolygonMode = PolygonMode.Fill;


                break;

            case Snapkind.CurveSnapItem3D:

                Bezier3D Bezier = new Bezier3D(new xyz(1, 2, 1), new xyz(3, -2, 3), new xyz(5, 3, 2), new xyz(7, 1, 1));

                drawCurve(Bezier);


                break;

            case Snapkind.PolyLineSnapItem3D:
                xyzArray Poly3d = new xyzArray();
                Poly3d.data = new xyz[] { new xyz(0, 0, 1), new xyz(0, 3, 1), new xyz(3, 3, 1), new xyz(4, 0, 1), new xyz(0, 0, 1) };
                drawPolyLine(Poly3d);
                break;

            case Snapkind.PolyPolyLineSnapItem3D:

                xyzArray AA = new xyzArray();
                AA.Add(new xyz(1, 1, 1));
                AA.Add(new xyz(0, 1, 1));
                AA.Add(new xyz(0, 0, 1));
                AA.Add(new xyz(1, 0, 1));
                AA.Add(new xyz(1, 1, 1));
                xyzArray BB = new xyzArray();

                BB.Add(new xyz(3, 3, 1));
                BB.Add(new xyz(3, -2, 1));
                BB.Add(new xyz(-1, -2, 1));
                BB.Add(new xyz(-1, 3, 1));
                BB.Add(new xyz(3, 3, 1));



                Loxyz L = new Loxyz();
                L.Add(AA);
                L.Add(BB);


                drawPolyPolyLine(L);

                break;

            case Snapkind.PolyPolyLineSnapItem:

                xyArray _AA = new xyArray();
                _AA.Add(new xy(2, 0.5));
                _AA.Add(new xy(0, 0.5));
                _AA.Add(new xy(0, 0));
                _AA.Add(new xy(2, 0));
                _AA.Add(new xy(2, 0.5));
                xyArray _BB = new xyArray();

                _BB.Add(new xy(4, 4));
                _BB.Add(new xy(4, -2));
                _BB.Add(new xy(-1, -2));
                _BB.Add(new xy(-1, 4));

                _BB.Add(new xy(4, 4));
                Loxy _L = new Loxy();
                _L.Add(_AA);
                _L.Add(_BB);


                drawPolyPolyLine(_L);

                break;

            case Snapkind.SphereSnapItem:
                drawSphere(new xyz(2, 1, 1), 3);


                break;

            case Snapkind.BoxSnapItem:

                drawBox(new xyz(0, 0, 0), new xyz(4, 3, 4));
                break;

            default:
                break;
            }
            ACursor.Paint(this);
        }
Beispiel #3
0
        private void Constructure_Click(object sender, EventArgs e)
        {
            //packnum = int.Parse(packn.Text);
            //locanum = int.Parse(locan.Text);
            //copiesnum = int.Parse(copies.Text);
            packnum = 2000;
            locanum = 20;
            copiesnum = 10;
            picc = new int[10];
            node = new Node[100];
            income = new bool[100];
            for (int i = 0; i < 100; i++)
            {
                node[i] = new Node();
                node[i].Visit = new double[21];
                node[i].VTotal = 0;
                node[i].FTable = new double[21];
                node[i].current = 0;
                node[i].Rank = 0;
                node[i].buffer = new int[(packnum + 1)];
                income[i] = false;

            }

            packet = new Packet[(int)packnum];
            for (int j = 0; j < packnum; j++)
            {
                packet[j] = new Packet();
                packet[j].current = 0;
                packet[j].so = 0;
                packet[j].des = 0;
                packet[j].Rank = 0;
                packet[j].transtime = 0;
                packet[j].begintime = 0;
                packet[j].fin = false;
                packet[j].PTable = new double[(locanum + 1)];

            }

            location = new Loca[(int)locanum + 1];
            for (int k = 0; k < locanum + 1; k++)
            {
                location[k] = new Loca();
                location[k].buffer = new int[(packnum)];
            }
            state.Text = "Construct over.";
        }
Beispiel #4
0
        public void SetEntityKind(Entitykind Kind)
        {
            Entities = Kind;

            if (Entities != Entitykind.CtrlRectangle)
            {
                if (CRect != null)
                {
                    CRect.Device = null;
                }
            }
            switch (Entities)

            {
            case Entitykind.Boxentity:
            {
                Box = new BoxEntity(new xyz(0, 0, 0), new xyz(4, 5, 6));

                break;
            }

            case Entitykind.PolyCurveExtruder:
            {
                PolyCurveEx = new PolyCurveExtruder();
                Loca       _Loca   = new Loca();
                CurveArray Curves0 = new CurveArray();
                Curves0.Count = 4;
                Curves0[0]    = new Line(new xy(-3, -3), new xy(-3, 4));
                Curves0[1]    = new Line(new xy(-3, 4), new xy(4, 4));
                Curves0[2]    = new Line(new xy(4, 4), new xy(4, -3));
                Curves0[3]    = new Line(new xy(4, -3), new xy(-3, -3));

                _Loca.Add(Curves0);
                OpenGlDevice.CheckError();
                CurveArray Curves1 = new CurveArray();
                Curves1.Count = 4;
                Curves1[0]    = new Line(new xy(0, 0), new xy(1, 0));
                Curves1[1]    = new Line(new xy(1, 0), new xy(1, 1));
                Curves1[2]    = new Line(new xy(1, 1), new xy(0, 1));
                Curves1[3]    = new Line(new xy(0, 1), new xy(0, 0));
                _Loca.Add(Curves1);

                PolyCurveEx.DownPlane     = new Plane(new xyz(0, 0, 0), new xyz(0, 0, 1));
                PolyCurveEx.UpPlane       = new Plane(new xyz(0, 0, 4), new xyz(0, 0.5, 1));
                PolyCurveEx.Loca          = _Loca;
                PolyCurveEx.ShowUpPlane   = true;
                PolyCurveEx.ShowDownPlane = true;
                PolyCurveEx.Height        = -1;
                PolyCurveEx.Direction     = new xyz(0, 1, 1);
                break;
            }

            case Entitykind.CoordinateAxis:
            {
                Axis                   = new CoordinateAxis();
                Axis.FullSize          = true;
                Axis.ShowText          = true;
                Axis.TextHeight        = 1;
                Axis.Color             = Color.Black;
                Axis.Size              = new xyz(10, 20, 30);
                Axis.Devider           = new xyz(4, 4, 4);
                Axis.DeviderLineLength = 0.3;
                Axis.LeftAndRight      = true;
                Axis.Dim3d             = true;
                Axis.ShowDevider       = true;
                break;
            }

            case Entitykind.TextEntity:
            {
                Text      = new TextEntity();
                Text.Text = "Drawing3d";

                Text.Size     = 4;
                Text.Italic   = true;
                Text.Position = new xyz(-5, 0, 0);
                break;
            }

            case Entitykind.Interpolator:

            {
                Interpolator        = new Interpolator3D();
                Interpolator.Points = new xyz[, ]
                {
                    { new xyz(-3, -3, 0), new xyz(-3, 0, 2), new xyz(-3, 3, 0), new xyz(-3, 6, -2) },
                    { new xyz(0, -3, 2), new xyz(0, 0, 3), new xyz(0, 3, 2), new xyz(0, 6, -2) },
                    { new xyz(3, -3, 3), new xyz(3, 0, 2), new xyz(3, 3, 1), new xyz(3, 6, -2) },
                    { new xyz(6, -3, 2), new xyz(6, 0, 0), new xyz(6, 3, 0), new xyz(6, 6, -2) }
                };

                break;
            };



            case Entitykind.Zoom:

            {
                Zoom        = new RectCtrlZoom(this);
                Zoom.Device = this;
                Zoom.Color  = Color.White;
                break;
            }

            case Entitykind.CtrlRectangle:

            {
                CRect               = new CtrlRectangle(this);
                CRect.Color         = Color.Black;
                CRect.MarkerColor   = Color.Red;
                CRect.Creating      = false;
                CRect.Rectangle     = new RectangleF(-1, -1, 6, 5);
                CRect.CompileEnable = false;
                Triangle            = new xyArray();
                Triangle.data       = new xy[] { new xy(0, 0), new xy(2, 2), new xy(4, 0), new xy(0, 0) };
                CRect.TransformItems.Add(Triangle);

                // S = new SphereEntity(new xyz(0, 0, 0), 2);
                //S = new BoxEntity(new xyz(0, 0, 0), new xyz(4, 4, 4));
                //S.CompileEnable = false;
                // CRect.TransformItems.Add(S);
                // CRect.LiveTransform = true;
                break;
            }

            case Entitykind.Profiler:

            {
                xyzArray A = new xyzArray();
                A.data = new xyz[] { new xyz(-3, 0, 0), new xyz(-3, -4, 0), new xyz(3, -4, 0), new xyz(3, 0, 0) };
                Loca       _Loca   = new Loca();
                CurveArray Curves0 = new CurveArray();
                Curves0.Count = 4;
                Curves0[0]    = new Line(new xy(-1, -1), new xy(-1, 2));
                Curves0[1]    = new Line(new xy(-1, 2), new xy(2, 2));
                Curves0[2]    = new Line(new xy(2, 2), new xy(2, -1));
                Curves0[3]    = new Line(new xy(2, -1), new xy(-1, -1));
                _Loca.Add(Curves0);
                OpenGlDevice.CheckError();
                CurveArray Curves1 = new CurveArray();
                Curves1.Count = 4;
                Curves1[0]    = new Line(new xy(0, 0), new xy(1, 0));
                Curves1[1]    = new Line(new xy(1, 0), new xy(1, 1));
                Curves1[2]    = new Line(new xy(1, 1), new xy(0, 1));
                Curves1[3]    = new Line(new xy(0, 1), new xy(0, 0));
                _Loca.Add(Curves1);
                Profil = new Profiler();
                Profil.CompileEnable = false;
                Profil.Trace         = A;
                Profil.Transverse    = _Loca;
                Profil.CloseFirst    = true;
                Profil.CloseLast     = true;
                break;
            }

            case Entitykind.ActiveCursor:
            {
                //  ActiveC.CrossColor = Color.Red;
                break;
            }

            case Entitykind.SphereEntity:
            {
                Sphere = new SphereEntity(new xyz(3, 2, 1), 4);
                //  Sphere.CompileEnable = false;
                //  Sphere = new SphereEntity(new xyz(0, 0, 0), 4);
                break;
            }

            case Entitykind.Cone:
            {
                Cone = new Cone(3, 5);
                break;
            }

            case Entitykind.Arrow:
            {
                Arrow = new Arrow();
                Arrow.Transformation = Matrix.Translation(new xyz(5, 0, 0));
                Arrow.SetShaftAndTop(new xyz(-10, 0, 0), new xyz(0, 0, 0));
                Arrow.Size = 8;
                drawSphere(new xyz(0, 0, 0), 0.5);
                break;
            }
            }


            Selector.RefreshSnapBuffer();
        }
Beispiel #5
0
        public override void OnPaint()


        {
            BackColor = Color.White;
            switch (Entities)

            {
            case Entitykind.Boxentity:
            {
                Box.Paint(this);


                break;
            }

            case Entitykind.PolyCurveExtruder:
            {
                PolyCurveEx.Paint(this);

                break;
            }

            case Entitykind.CoordinateAxis:
            {
                Axis.Paint(this);
                break;
            }

            case Entitykind.TextEntity:
            {
                Text.Paint(this);

                break;
            }

            case Entitykind.Interpolator:

            {
                Interpolator.Paint(this);
                break;
            }

            case Entitykind.Zoom:

            {
                drawSphere(new xyz(0, 0, 0), 7, 80, 80);
                drawBox(new xyz(-10, -10, -1), new xyz(20, 20, 1));
                drawBox(new xyz(0, 0, 0), new xyz(2, 2, 2));

                break;
            }

            case Entitykind.CtrlRectangle:

            {
                PenWidth    = 2;
                PolygonMode = PolygonMode.Line;
                drawPolyLine(Triangle);
                PolygonMode = PolygonMode.Fill;
                PenWidth    = 1;

                break;
            }

            case Entitykind.Profiler:

            {
                Profil.Paint(this);


                break;
            }

            case Entitykind.ActiveCursor:
            {
                PolyCurveEx = new PolyCurveExtruder();
                Loca       _Loca   = new Loca();
                CurveArray Curves0 = new CurveArray();
                Curves0.Count = 4;
                Curves0[0]    = new Line(new xy(-3, -3), new xy(-3, 4));
                Curves0[1]    = new Line(new xy(-3, 4), new xy(4, 4));
                Curves0[2]    = new Line(new xy(4, 4), new xy(4, -3));
                Curves0[3]    = new Line(new xy(4, -3), new xy(-3, -3));

                _Loca.Add(Curves0);
                OpenGlDevice.CheckError();
                CurveArray Curves1 = new CurveArray();
                Curves1.Count = 4;
                Curves1[0]    = new Line(new xy(0, 0), new xy(1, 0));
                Curves1[1]    = new Line(new xy(1, 0), new xy(1, 1));
                Curves1[2]    = new Line(new xy(1, 1), new xy(0, 1));
                Curves1[3]    = new Line(new xy(0, 1), new xy(0, 0));
                _Loca.Add(Curves1);

                PolyCurveEx.DownPlane     = new Plane(new xyz(0, 0, 0), new xyz(0, 0, 1));
                PolyCurveEx.UpPlane       = new Plane(new xyz(0, 0, 4), new xyz(0, 0.5, 1));
                PolyCurveEx.Loca          = _Loca;
                PolyCurveEx.ShowUpPlane   = true;
                PolyCurveEx.ShowDownPlane = true;
                PolyCurveEx.Height        = -1;
                PolyCurveEx.Direction     = new xyz(0, 1, 1);
                PolyCurveEx.Paint(this);

                ActiveC.Paint(this);
                break;
            }


            case Entitykind.SphereEntity:
            {
                Sphere.Paint(this);
                break;
            }

            case Entitykind.Cone:
            {
                Cone.Paint(this);



                break;
            }

            case Entitykind.Arrow:
            {
                Arrow.Paint(this);

                break;
            }

            case Entitykind.VisualBase:
            {
                VisualBase VB = new VisualBase();
                VB.SnappEnable      = false;
                VB.xAxis.ShaftColor = Color.Blue;
                VB.yAxis.ShaftColor = Color.Green;
                VB.zAxis.ShaftColor = Color.Yellow;
                VB.xAxis.TopColor   = Color.Red;
                VB.yAxis.TopColor   = Color.Red;
                VB.zAxis.TopColor   = Color.Red;
                VB.Paint(this);
                break;
            }
            }
            ActiveC.Paint(this);

            base.OnPaint();
        }
Beispiel #6
0
 public PolyPolyCurveSnapItem(Loca Loca)
 {
     this.Loca = Loca;
 }