Пример #1
0
        public Drawing_Box(G.Region reg, List <G.Line> reinf)
        {
            InitializeComponent();
            this.Size           = new System.Drawing.Size(s + 40, s + 65);
            this.pb_visual.Size = new System.Drawing.Size(s, s);
            r  = reg;
            re = reinf;

            flag = true;
        }
Пример #2
0
        public Drawing_Box(G.Region reg, List <G.Edge> emptyEdgesDebug, List <G.Corner> emptyCornersDebug, List <G.Edge> setEdgesDebug, List <G.Corner> setCornerDebug, List <G.Line> reinf)
        {
            InitializeComponent();
            this.Size           = new System.Drawing.Size(s + 40, s + 65);
            this.pb_visual.Size = new System.Drawing.Size(s, s);
            r  = reg;
            re = reinf;

            notE = emptyEdgesDebug;
            notC = emptyCornersDebug;
            setE = setEdgesDebug;
            setC = setCornerDebug;

            flag = false;
        }
Пример #3
0
        private void draw_region(G.Region r, List <G.Line> reinf, PaintEventArgs e)
        {
            foreach (G.Line re in reinf)
            {
                Pen ppp = new Pen(Color.Cyan, 2);
                draw_line(re, ppp, e);
            }

            // EDGES
            foreach (G.Edge ee in r.edges)
            {
                Pen ppp = new Pen(Color.DarkRed, 2);
                draw_line(ee.Line, ppp, e);
            }

            //CENTER POINT OFFSET
            foreach (G.Edge ee in r.edges)
            {
                G.Point  cp = ee.Line.getCenterPoint();
                G.Vector ov = ee.Line.getOffsetVector();
                G.Point  op = cp.move(20, ov);

                Pen ppp = new Pen(Color.Red, 2);
                draw_point(op, ppp, e);
            }

            //CORNERS
            foreach (G.Corner cr in r.corners)
            {
                if (Math.Abs(Math.Abs(cr.Angle) - Math.PI / 2) < 0.01)
                {
                    Pen ppp = new Pen(Color.Green, 2);
                    draw_circle(cr.CP, ppp, e);
                }
                else if (Math.Abs(cr.Angle) > Math.PI)
                {
                    Pen ppp = new Pen(Color.Red, 2);
                    draw_circle(cr.CP, ppp, e);
                }
                else
                {
                    Pen ppp = new Pen(Color.Blue, 2);
                    draw_circle(cr.CP, ppp, e);
                }
            }
        }
Пример #4
0
        private G.Region regioon()
        {
            List <G.Line> contours = new List <G.Line>();

            int of = -1500;
            int wi = 6510;
            int he = 2695;

            G.Point a = new G.Point(of, of);
            G.Point b = new G.Point(of + wi, of);
            G.Point c = new G.Point(of + wi, of + he);
            G.Point z = new G.Point(of + (wi / 2), of + he + 200);
            G.Point d = new G.Point(of, of + he);

            G.Point a2 = new G.Point(of + 2000, of + 1000);
            G.Point b2 = new G.Point(of + 2000, of + 2000);
            G.Point c2 = new G.Point(of + 4000, of + 2000);
            G.Point d2 = new G.Point(of + 4000, of + 1000);

            G.Line k = new G.Line(a, b);
            G.Line l = new G.Line(c, b);
            G.Line x = new G.Line(c, z);
            G.Line m = new G.Line(z, d);
            G.Line n = new G.Line(a, d);

            G.Line k2 = new G.Line(a2, b2);
            G.Line l2 = new G.Line(b2, c2);
            G.Line m2 = new G.Line(c2, d2);
            G.Line n2 = new G.Line(d2, a2);

            contours.Add(k);
            contours.Add(l);
            contours.Add(m);
            contours.Add(n);
            contours.Add(x);

            contours.Add(k2);
            contours.Add(l2);
            contours.Add(m2);
            contours.Add(n2);

            G.Region r = new G.Region(contours);

            return(r);
        }
Пример #5
0
        private void set_scale(G.Region r)
        {
            double mix = r.Min_X;
            double miy = r.Min_Y;
            double mxx = r.Max_X;
            double mxy = r.Max_Y;

            double dx = Math.Abs(mxx - mix);
            double dy = Math.Abs(mxy - miy);

            double sc1 = dx / (s * 0.95);
            double sc2 = dy / (s * 0.95);

            scale = Convert.ToInt32(Math.Max(sc1, sc2));

            double nulloffsetX = (r.Min_X / scale) - ((s - (dx / scale)) / 2);
            double nulloffsetY = s + (r.Min_Y / scale) - ((s - (dy / scale)) / 2);

            nullX = Convert.ToInt32(nulloffsetX);
            nullY = Convert.ToInt32(nulloffsetY);
        }
Пример #6
0
        public ReinforcmentHandler(List <G.Line> polys)
        {
            DebugerWindow _debuger = new DebugerWindow();

            //_debuger.Show();

            r = new G.Region(polys);

            allEdges   = new List <G.Edge>(r.edges);
            allCorners = new List <G.Corner>(r.corners);

            setEdges       = new Dictionary <G.Edge, R.Raud>();
            setCorners     = new Dictionary <G.Corner, R.Raud>();
            setLineSegment = new List <LineSegment>();

            knownReinforcement       = new List <R.Raud>();
            knownArrayReinforcement  = new List <R.Raud_Array>();
            knownUniqueReinforcement = new List <R.Raud>();
            reinf_geometry_debug     = new List <G.Line>();

            setCalculatedParameters();
        }
Пример #7
0
        private void draw_region(G.Region r, PaintEventArgs e)
        {
            foreach (G.Edge ee in r.edges)
            {
                Pen ppp = new Pen(Color.DarkRed, 2);
                draw_line(ee.Line, ppp, e);
            }

            foreach (G.Corner cr in r.corners)
            {
                if (Math.Abs(Math.Abs(cr.Angle) - Math.PI / 2) < 0.01)
                {
                    Pen ppp = new Pen(Color.Green, 2);
                    draw_circle(cr.CP, ppp, e);
                }
                else if (Math.Abs(cr.Angle) > Math.PI)
                {
                    Pen ppp = new Pen(Color.Red, 2);
                    draw_circle(cr.CP, ppp, e);
                }
                else
                {
                    Pen ppp = new Pen(Color.Blue, 2);
                    draw_circle(cr.CP, ppp, e);
                }
            }

            foreach (G.Edge ee in r.edges)
            {
                G.Point  cp = ee.Line.getCenterPoint();
                G.Vector ov = ee.Line.getOffsetVector();
                G.Point  op = cp.move(100, ov);

                Pen ppp = new Pen(Color.Red, 2);
                draw_point(op, ppp, e);
            }
        }
Пример #8
0
 private void drawingArea_Paint(object sender, PaintEventArgs e)
 {
     G.Region r = regioon();
     set_scale(r);
     draw_region(r, e);
 }