public bool define_simple_B(G.Edge startEdge, G.Edge endEdge)
        {
            double cover1 = _V_.X_CONCRETE_COVER_2;
            double cover2 = _V_.X_CONCRETE_COVER_2;

            double mainDist = _V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH;
            double sideDist = _V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH;

            G.Corner sharedCorner = null;
            G.Point  IP           = getCornerPoint(startEdge, endEdge, cover1, cover2, ref sharedCorner);

            G.Vector v1 = endEdge.Line.getOffsetVector();
            G.Vector v2 = startEdge.Line.getCoolVector(v1);

            G.Vector v3 = startEdge.Line.getOffsetVector();
            G.Vector v4 = endEdge.Line.getCoolVector(v3);

            G.Point mainEndPoint = IP.move(mainDist, v2);
            G.Point sidePoint    = IP.move(sideDist, v4);

            //A_handler_debug(IP, mainEndPoint);
            //A_handler_debug(sidePoint, IP);

            bool success = B_vs_C_handler(IP, mainEndPoint, sidePoint, null, sharedCorner);

            return(success);
        }
        private void keep(R.Raud reinf, G.Edge edge, G.Corner corner1, G.Corner corner2)
        {
            if (edge != null)
            {
                if (!setEdges.Keys.Contains(edge))
                {
                    setEdges[edge] = reinf;
                }
            }

            if (corner1 != null)
            {
                if (!setCorners.Keys.Contains(corner1))
                {
                    setCorners[corner1] = reinf;
                }
            }

            if (corner2 != null)
            {
                if (!setCorners.Keys.Contains(corner2))
                {
                    setCorners[corner2] = reinf;
                }
            }

            knownReinforcement.Add(reinf);
        }
Esempio n. 3
0
        private void create_valid_D()
        {
            List <G.Edge> emptyEdges = allEdges.Where(x => !setEdges.Keys.Contains(x)).ToList();

            emptyEdges = emptyEdges.OrderBy(b => b.Line.Length()).Reverse().ToList();

            foreach (G.Edge e in emptyEdges)
            {
                G.Corner sc = e.StartCorner;
                G.Corner ec = e.EndCorner;

                G.Edge side1Edge = sc.getOtherEdge(e);
                G.Edge side2Edge = ec.getOtherEdge(e);

                bool c1 = !setCorners.Keys.Contains(sc);
                bool c2 = !setCorners.Keys.Contains(ec);
                bool c3 = sc.Angle < Math.PI;
                bool c4 = ec.Angle < Math.PI;
                bool c5 = setEdges.Keys.Contains(side1Edge);
                bool c6 = setEdges.Keys.Contains(side2Edge);

                if (c1 && c2 && c3 && c4 && c5 && c6)
                {
                    define_simple_D(e, side1Edge, side2Edge);
                }
            }
        }
Esempio n. 4
0
        private void create_extended_B()
        {
            List <G.Edge> emptyEdges = allEdges.Where(x => !setEdges.Keys.Contains(x)).ToList();

            emptyEdges = emptyEdges.OrderBy(b => b.Line.Length()).Reverse().ToList();

            foreach (G.Edge e in emptyEdges)
            {
                G.Corner sc = e.StartCorner;
                G.Corner ec = e.EndCorner;

                bool c1 = sc.Angle > Math.PI;
                bool c2 = ec.Angle > Math.PI;

                if (c1 && c2)
                {
                    continue;
                }
                if (!c1 && !c2)
                {
                    continue;
                }

                if (c1) //startCorner >> math.pi
                {
                    G.Edge otherEdge = ec.getOtherEdge(e);
                    define_B(otherEdge, e);
                }
                else if (c2) //endCorner >> math.pi
                {
                    G.Edge otherEdge = sc.getOtherEdge(e);
                    define_B(e, otherEdge);
                }
            }
        }
Esempio n. 5
0
        private void create_oversized_D()
        {
            List <G.Edge> emptyEdges = allEdges.Where(x => !setEdges.Keys.Contains(x)).ToList();

            emptyEdges = emptyEdges.OrderBy(b => b.Line.Length()).Reverse().ToList();

            foreach (G.Edge e in emptyEdges)
            {
                G.Corner sc = e.StartCorner;
                G.Corner ec = e.EndCorner;

                G.Edge side1Edge = sc.getOtherEdge(e);
                G.Edge side2Edge = ec.getOtherEdge(e);

                bool c1 = !setCorners.Keys.Contains(sc);
                bool c2 = !setCorners.Keys.Contains(ec);
                bool c3 = sc.Angle < Math.PI;
                bool c4 = ec.Angle < Math.PI;
                bool c5 = setEdges.Keys.Contains(side1Edge);
                bool c6 = setEdges.Keys.Contains(side2Edge);

                if (c1 && c2 && c3 && c4)
                {
                    if (!c5 && !c6)
                    {
                        if (side1Edge.Line.Length() < _V_.Y_REINFORCEMENT_MAIN_MIN_LENGTH)
                        {
                            if (side2Edge.Line.Length() < _V_.Y_REINFORCEMENT_MAIN_MIN_LENGTH)
                            {
                                define_simple_D(e, side1Edge, side2Edge);
                            }
                        }
                    }
                    else if (!c5)
                    {
                        if (side1Edge.Line.Length() < _V_.Y_REINFORCEMENT_MAIN_MIN_LENGTH)
                        {
                            define_simple_D(e, side1Edge, side2Edge);
                        }
                    }
                    else if (!c6)
                    {
                        if (side2Edge.Line.Length() < _V_.Y_REINFORCEMENT_MAIN_MIN_LENGTH)
                        {
                            define_simple_D(e, side1Edge, side2Edge);
                        }
                    }
                }
            }
        }
        //A HANDLE
        public bool A_handler(G.Point mainPoint, G.Point mainEnd, G.Edge e, G.Corner c, int d)
        {
            G.Line main = new G.Line(mainPoint, mainEnd);
            //Debugerrint(main.ToString());
            //reinf_geometry_debug.Add(main);

            R.A_Raud reinf = new R.A_Raud(main, _V_.X_REINFORCEMENT_NUMBER, d, _V_.X_REINFORCEMENT_MARK);
            if (denier(reinf.makeLine()))
            {
                return(false);
            }
            keep(reinf, e, c, null);

            return(true);
        }
        public bool define_B(G.Edge startEdge, G.Edge endEdge)
        {
            bool startSet = setEdges.Keys.Contains(startEdge);
            bool endSet   = setEdges.Keys.Contains(endEdge);

            double cover1 = _V_.X_CONCRETE_COVER_1;
            double cover2 = _V_.X_CONCRETE_COVER_1;

            double mainDist = _V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH;
            double sideDist = _V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH;

            bool realCorner = G.Edge.haveSharedCorner(startEdge, endEdge);

            if (realCorner)
            {
                G.Corner cor = G.Edge.getSharedCorner(startEdge, endEdge);
                if (cor.Angle > Math.PI)
                {
                    return(false);
                }
            }

            if (startSet == true && endSet == true)
            {
                cover1 += _V_.Y_CONCRETE_COVER_DELTA;
                cover2 += _V_.Y_CONCRETE_COVER_DELTA;

                //mainDist == default
                //sideDist == default
            }
            else if (startSet == false && endSet == false)
            {
                double startLineLength = startEdge.Line.Length();
                double endLineLength   = endEdge.Line.Length();

                if (startLineLength > endLineLength)
                {
                    startSet = true;

                    cover1 += _V_.Y_CONCRETE_COVER_DELTA;
                    //cover2 == default

                    //mainDist == default
                    sideDist = endEdge.edgeOffset(cover1, cover1, cover2).Length();

                    if (endEdge.StartCorner.Angle > Math.PI)
                    {
                        sideDist += _V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH;
                    }
                }
                else
                {
                    endSet = true;

                    //cover1 == default
                    cover2 += _V_.Y_CONCRETE_COVER_DELTA;

                    mainDist = startEdge.edgeOffset(cover1, cover1, cover2).Length();
                    //sideDist == default

                    if (startEdge.EndCorner.Angle > Math.PI)
                    {
                        mainDist += _V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH;
                    }
                }

                if (startEdge.EndCorner.Angle > Math.PI)
                {
                    startLineLength += _V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH;
                }

                if (endEdge.StartCorner.Angle > Math.PI)
                {
                    endLineLength += _V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH;
                }
            }
            else if (startSet == false && endSet == true)
            {
                //cover1 == default
                cover2 += _V_.Y_CONCRETE_COVER_DELTA;

                mainDist = startEdge.edgeOffset(cover1, cover1, cover2).Length();
                //sideDist == default

                if (startEdge.EndCorner.Angle > Math.PI)
                {
                    mainDist += _V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH;
                }
            }
            else if (startSet == true && endSet == false)
            {
                cover1 += _V_.Y_CONCRETE_COVER_DELTA;
                //cover2 == defualt

                //mainDist == default
                sideDist = endEdge.edgeOffset(cover1, cover1, cover2).Length();

                if (endEdge.StartCorner.Angle > Math.PI)
                {
                    sideDist += _V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH;
                }
            }

            mainDist = Math.Max(mainDist, _V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH);
            sideDist = Math.Max(sideDist, _V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH);

            G.Corner sharedCorner = null;
            G.Point  IP           = getCornerPoint(startEdge, endEdge, cover1, cover2, ref sharedCorner);

            if (!realCorner)
            {
                if (startSet == false && endSet == true)
                {
                    G.Line  otherLine = startEdge.edgeOffset(cover1, cover1, cover2);
                    G.Point other     = IP.getClosePoint(otherLine.Start, otherLine.End);

                    double dist = other.distanceTo(IP);
                    mainDist += dist;
                }
                else if (startSet == true && endSet == false)
                {
                    G.Line  otherLine = endEdge.edgeOffset(cover1, cover1, cover2);
                    G.Point other     = IP.getClosePoint(otherLine.Start, otherLine.End);

                    double dist = other.distanceTo(IP);
                    sideDist += dist;
                }
            }

            G.Vector v1 = endEdge.Line.getOffsetVector();
            G.Vector v2 = startEdge.Line.getCoolVector(v1);

            G.Vector v3 = startEdge.Line.getOffsetVector();
            G.Vector v4 = endEdge.Line.getCoolVector(v3);

            G.Point mainEndPoint = IP.move(mainDist, v2);
            G.Point sidePoint    = IP.move(sideDist, v4);


            //A_handler_debug(IP, mainEndPoint);
            //A_handler_debug(sidePoint, IP);

            bool success = false;

            if (startSet == false)
            {
                success = B_vs_C_handler(IP, mainEndPoint, sidePoint, startEdge, sharedCorner);
            }
            else if (endSet == false)
            {
                success = B_vs_C_handler(IP, mainEndPoint, sidePoint, endEdge, sharedCorner);
            }
            else
            {
                success = B_vs_C_handler(IP, mainEndPoint, sidePoint, null, sharedCorner);
            }


            return(success);
        }
Esempio n. 8
0
        private G.Point getCornerPoint(G.Edge one, G.Edge two, double cover1, double cover2, ref G.Corner sharedCorner)
        {
            bool realCorner = G.Edge.getSharedCorner(one, two, ref sharedCorner);

            if (realCorner)
            {
                G.Point IP = sharedCorner.getCornerPoint(one, cover1, cover2);
                return(IP);
            }
            else
            {
                PseudoCorner pc = new PseudoCorner(one, two);
                G.Point      IP = pc.getCornerPoint(one, cover1, cover2);
                return(IP);
            }
        }
Esempio n. 9
0
        private void create_trimmed_short_A()
        {
            List <G.Edge> emptyEdges = allEdges.Where(x => !setEdges.Keys.Contains(x)).ToList();

            emptyEdges = emptyEdges.OrderBy(b => b.Line.Length()).ToList();

            foreach (G.Edge e in emptyEdges)
            {
                if (setEdges.Keys.Contains(e))
                {
                    continue;
                }
                if (narrow_denier(e))
                {
                    continue;
                }


                G.Edge temp = null;
                G.Line main = e.edgeOffset(_V_.X_CONCRETE_COVER_1, _V_.X_CONCRETE_COVER_1, _V_.X_CONCRETE_COVER_1);
                main = trimLine_baseline(main, main.Copy(), _V_.X_CONCRETE_COVER_2, e, ref temp);


                bool   startTrimmed     = false;
                G.Edge startTrimmerEdge = null;
                if (e.StartCorner.Angle > Math.PI)
                {
                    G.Line extended = main.extendStart(_V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH);
                    G.Line trimmed  = trimLine_basepoint(extended, main.End, _V_.X_CONCRETE_COVER_2, e, ref startTrimmerEdge);
                    if (trimmed.Length() < main.Length() + _V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH * _V_.M_TRIM_TOLERANCE)
                    {
                        startTrimmed = true;
                    }
                    main = trimmed;
                }


                bool   endTrimmed     = false;
                G.Edge endTrimmerEdge = null;
                if (e.EndCorner.Angle > Math.PI)
                {
                    G.Line extended = main.extendEnd(_V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH);
                    G.Line trimmed  = trimLine_basepoint(extended, main.Start, _V_.X_CONCRETE_COVER_2, e, ref endTrimmerEdge);
                    if (trimmed.Length() < main.Length() + _V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH * _V_.M_TRIM_TOLERANCE)
                    {
                        endTrimmed = true;
                    }
                    main = trimmed;
                }


                if (main.Length() <= _V_.Y_REINFORCEMENT_MAIN_MIN_LENGTH)
                {
                    if (startTrimmed && endTrimmed)
                    {
                        bool got_D = define_D(e, startTrimmerEdge, endTrimmerEdge);

                        if (got_D == false)
                        {
                            G.Vector v1 = main.getOffsetVector();
                            G.Vector v2 = startTrimmerEdge.Line.getCoolVector(v1);
                            G.Vector v3 = endTrimmerEdge.Line.getCoolVector(v1);

                            G.Point side1Point = main.Start.move(_V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH * 1.05, v2);
                            G.Point side2Point = main.End.move(_V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH * 1.05, v3);

                            G.Line side1 = new G.Line(side1Point, main.Start);
                            G.Line side2 = new G.Line(main.End, side2Point);

                            if (denier(side1) && denier(side2))
                            {
                                G.Point AP     = main.Start.move(_V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH * 1.5, v2);
                                G.Line  b_line = new G.Line(main.Start, AP);

                                G.Edge side1TrimmerEdge = null;
                                G.Line side1Main        = trimLine_basepoint(b_line, main.Start, _V_.X_CONCRETE_COVER_2, e, ref side1TrimmerEdge);

                                G.Point AP2     = main.End.move(_V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH * 1.5, v3);
                                G.Line  b_line2 = new G.Line(main.End, AP2);

                                G.Edge side2TrimmerEdge = null;
                                G.Line side2Main        = trimLine_basepoint(b_line2, main.End, _V_.X_CONCRETE_COVER_2, e, ref side2TrimmerEdge);

                                A_handler(main.Start, main.End, e, null, _V_.X_REINFORCEMENT_MAIN_DIAMETER);
                                define_D(startTrimmerEdge, side1TrimmerEdge, e);
                                define_D(endTrimmerEdge, e, side2TrimmerEdge);
                            }
                            else if (denier(side1))
                            {
                                G.Point AP     = main.Start.move(_V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH * 1.5, v2);
                                G.Line  b_line = new G.Line(main.Start, AP);

                                G.Edge sideTrimmerEdge = null;
                                G.Line newMain         = trimLine_basepoint(b_line, main.Start, _V_.X_CONCRETE_COVER_2, e, ref sideTrimmerEdge);

                                B_vs_C_handler(main.End, side2Point, main.Start, e, null);
                                define_D(startTrimmerEdge, sideTrimmerEdge, e);
                            }
                            else if (denier(side2))
                            {
                                G.Point AP     = main.End.move(_V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH * 1.5, v2);
                                G.Line  b_line = new G.Line(main.End, AP);

                                G.Edge sideTrimmerEdge = null;
                                G.Line newMain         = trimLine_basepoint(b_line, main.End, _V_.X_CONCRETE_COVER_2, e, ref sideTrimmerEdge);

                                define_D(endTrimmerEdge, e, sideTrimmerEdge);
                                B_vs_C_handler(main.Start, main.End, side1Point, e, null);
                            }
                        }
                    }
                    else if (startTrimmed)
                    {
                        bool got_B = define_B(e, startTrimmerEdge);

                        if (got_B == false)
                        {
                            G.Vector v1 = e.Line.getOffsetVector();
                            G.Vector v2 = startTrimmerEdge.Line.getCoolVector(v1);

                            G.Point AP     = main.Start.move(_V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH * 2, v2);
                            G.Line  b_line = new G.Line(main.Start, AP);

                            G.Edge sideTrimmerEdge = null;
                            G.Line newMain         = trimLine_basepoint(b_line, main.Start, _V_.X_CONCRETE_COVER_2, e, ref sideTrimmerEdge);

                            if (sideTrimmerEdge != null)
                            {
                                bool got_D = define_D(startTrimmerEdge, sideTrimmerEdge, e);
                                if (got_D)
                                {
                                    A_handler(main.Start, main.End, e, null, _V_.X_REINFORCEMENT_MAIN_DIAMETER);
                                }
                            }
                            else
                            {
                                G.Corner ec = e.EndCorner;
                                if (ec.Angle < Math.PI)
                                {
                                    G.Edge otherEdge = ec.getOtherEdge(e);
                                    define_D(e, startTrimmerEdge, otherEdge);
                                }
                            }
                        }
                    }
                    else if (endTrimmed)
                    {
                        bool got_B = define_B(endTrimmerEdge, e);

                        if (got_B == false)
                        {
                            G.Vector v1 = e.Line.getOffsetVector();
                            G.Vector v2 = endTrimmerEdge.Line.getCoolVector(v1);

                            G.Point AP     = main.End.move(_V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH * 2, v2);
                            G.Line  b_line = new G.Line(main.End, AP);

                            G.Edge sideTrimmerEdge = null;
                            G.Line newMain         = trimLine_basepoint(b_line, main.End, _V_.X_CONCRETE_COVER_2, e, ref sideTrimmerEdge);

                            if (sideTrimmerEdge != null)
                            {
                                bool got_D = define_D(endTrimmerEdge, e, sideTrimmerEdge);
                                if (got_D)
                                {
                                    A_handler(main.Start, main.End, e, null, _V_.X_REINFORCEMENT_MAIN_DIAMETER);
                                }
                            }
                            else
                            {
                                G.Corner sc = e.StartCorner;
                                if (sc.Angle < Math.PI)
                                {
                                    G.Edge otherEdge = sc.getOtherEdge(e);
                                    define_D(e, otherEdge, endTrimmerEdge);
                                }
                            }
                        }
                    }
                }
            }
        }
        public bool define_simple_D(G.Edge mainEdge, G.Edge side1Edge, G.Edge side2Edge)
        {
            bool mainSet  = setEdges.Keys.Contains(mainEdge);
            bool side1Set = setEdges.Keys.Contains(side1Edge);
            bool side2Set = setEdges.Keys.Contains(side2Edge);


            double cover1    = _V_.X_CONCRETE_COVER_1;
            double coverMain = _V_.X_CONCRETE_COVER_1;
            double cover2    = _V_.X_CONCRETE_COVER_1;
            int    parand    = 0;

            double side1Dist = _V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH;
            double mainDist  = mainEdge.Line.Length();
            double side2Dist = _V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH;


            G.Corner startCorner = null;
            G.Point  IP1         = getCornerPoint(side1Edge, mainEdge, cover1, coverMain, ref startCorner);
            if (startCorner == null)
            {
                return(false);
            }

            G.Corner endCorner = null;
            G.Point  IP2       = getCornerPoint(mainEdge, side2Edge, coverMain, cover2, ref endCorner);
            if (endCorner == null)
            {
                return(false);
            }


            if (mainSet == true)
            {
                coverMain = coverMain + _V_.Y_CONCRETE_COVER_DELTA;
            }

            if (side1Set == true)
            {
                cover1 = cover1 + _V_.Y_CONCRETE_COVER_DELTA;
            }
            else
            {
                if (side1Edge.getOtherCorner(startCorner).Angle > Math.PI)
                {
                    side1Dist = side1Dist + side1Edge.Line.Length();
                }
                else
                {
                    side1Dist = side1Edge.edgeOffset(_V_.X_CONCRETE_COVER_1, _V_.X_CONCRETE_COVER_1, _V_.X_CONCRETE_COVER_1).Length();
                }
            }

            if (side2Set == true)
            {
                cover2 = cover2 + _V_.Y_CONCRETE_COVER_DELTA;
            }
            else
            {
                if (side2Edge.getOtherCorner(endCorner).Angle > Math.PI)
                {
                    side2Dist = side2Dist + side2Edge.Line.Length();
                }
                else
                {
                    side2Dist = side2Edge.edgeOffset(_V_.X_CONCRETE_COVER_1, _V_.X_CONCRETE_COVER_1, _V_.X_CONCRETE_COVER_1).Length();
                }
            }

            if (side1Dist != side2Dist)
            {
                double max = Math.Max(side1Dist, side2Dist);
                side1Dist = max;
                side2Dist = max;
            }

            IP1 = getCornerPoint(side1Edge, mainEdge, cover1, coverMain, ref startCorner);
            IP2 = getCornerPoint(mainEdge, side2Edge, coverMain, cover2, ref endCorner);

            G.Vector v1 = mainEdge.Line.getOffsetVector();
            G.Vector v2 = side1Edge.Line.getCoolVector(v1);
            G.Vector v3 = side2Edge.Line.getCoolVector(v2);

            G.Point side1Start = IP1.move(side1Dist, v2);
            G.Point side2End   = IP2.move(side2Dist, v3);

            //A_handler_debug(side1Start, IP1);
            //A_handler_debug(IP1, IP2);
            //A_handler_debug(IP2, side2End);

            bool success = false;

            if (side1Set == false && side2Set == false)
            {
                success = D_vs_E_handler(IP1, IP2, side1Start, side2End, mainEdge, startCorner, endCorner, parand, side1Edge, side2Edge); // parand magic
            }
            else if (side1Set == false)
            {
                success = D_vs_E_handler(IP1, IP2, side1Start, side2End, mainEdge, startCorner, endCorner, parand, side1Edge); // parand magic
            }
            else if (side2Set == false)
            {
                success = D_vs_E_handler(IP1, IP2, side1Start, side2End, mainEdge, startCorner, endCorner, parand, side2Edge); // parand magic
            }
            else
            {
                success = D_vs_E_handler(IP1, IP2, side1Start, side2End, mainEdge, startCorner, endCorner, parand); // parand magic
            }


            return(success);
        }
        public bool define_D(G.Edge mainEdge, G.Edge side1Edge, G.Edge side2Edge)
        {
            bool mainSet  = setEdges.Keys.Contains(mainEdge);
            bool side1Set = setEdges.Keys.Contains(side1Edge);
            bool side2Set = setEdges.Keys.Contains(side2Edge);

            double cover1    = _V_.X_CONCRETE_COVER_2;
            double coverMain = _V_.X_CONCRETE_COVER_1;
            double cover2    = _V_.X_CONCRETE_COVER_2;
            int    parand    = 2 * _V_.Y_CONCRETE_COVER_DELTA - 10; // parand magic

            double side1Dist = _V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH;
            double mainDist  = mainEdge.Line.Length();
            double side2Dist = _V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH;

            if (mainSet == true)
            {
                coverMain = coverMain + _V_.Y_CONCRETE_COVER_DELTA;
            }

            G.Corner startCorner = null;
            G.Point  IP1         = getCornerPoint(side1Edge, mainEdge, cover1, coverMain, ref startCorner);

            G.Corner endCorner = null;
            G.Point  IP2       = getCornerPoint(mainEdge, side2Edge, coverMain, cover2, ref endCorner);

            G.Vector v1 = mainEdge.Line.getOffsetVector();
            G.Vector v2 = side1Edge.Line.getCoolVector(v1);
            G.Vector v3 = side2Edge.Line.getCoolVector(v2);

            G.Point side1Start = IP1.move(side1Dist, v2);
            G.Point side2End   = IP2.move(side2Dist, v3);

            if (startCorner != null)
            {
                if (setCorners.Keys.Contains(startCorner))
                {
                    if (setEdges.Keys.Contains(mainEdge))
                    {
                        if (!ReferenceEquals(setCorners[startCorner], setEdges[mainEdge]))
                        {
                            coverMain = coverMain + _V_.Y_CONCRETE_COVER_DELTA;
                        }
                    }

                    if (setEdges.Keys.Contains(side1Edge))
                    {
                        if (!ReferenceEquals(setCorners[startCorner], setEdges[side1Edge]))
                        {
                            cover1 = cover1 + _V_.Y_CONCRETE_COVER_DELTA;
                        }
                    }

                    IP1        = getCornerPoint(side1Edge, mainEdge, cover1, coverMain, ref startCorner);
                    IP2        = getCornerPoint(mainEdge, side2Edge, coverMain, cover2, ref endCorner);
                    side1Start = IP1.move(side1Dist, v2);
                    side2End   = IP2.move(side2Dist, v3);

                    startCorner = null;
                }
            }

            if (endCorner != null)
            {
                if (setCorners.Keys.Contains(endCorner))
                {
                    if (setEdges.Keys.Contains(mainEdge))
                    {
                        if (!ReferenceEquals(setCorners[endCorner], setEdges[mainEdge]))
                        {
                            coverMain = coverMain + _V_.Y_CONCRETE_COVER_DELTA;
                        }
                    }

                    if (setEdges.Keys.Contains(side2Edge))
                    {
                        if (!ReferenceEquals(setCorners[endCorner], setEdges[side2Edge]))
                        {
                            cover2 = cover2 + _V_.Y_CONCRETE_COVER_DELTA;
                        }
                    }

                    IP1        = getCornerPoint(side1Edge, mainEdge, cover1, coverMain, ref startCorner);
                    IP2        = getCornerPoint(mainEdge, side2Edge, coverMain, cover2, ref endCorner);
                    side1Start = IP1.move(side1Dist, v2);
                    side2End   = IP2.move(side2Dist, v3);

                    endCorner = null;
                }
            }

            //A_handler_debug(side1Start, IP1);
            //A_handler_debug(IP1, IP2);
            //A_handler_debug(IP2, side2End);

            bool success = false;

            if (mainSet == true)
            {
                success = D_vs_E_handler(IP1, IP2, side1Start, side2End, null, startCorner, endCorner, parand); // parand magic
            }
            else
            {
                success = D_vs_E_handler(IP1, IP2, side1Start, side2End, mainEdge, startCorner, endCorner, parand); // parand magic
            }


            return(success);
        }
        //D HANDLE
        private bool D_vs_E_handler(G.Point mainPoint, G.Point mainEnd, G.Point side1Start, G.Point side2End, G.Edge e, G.Corner c1, G.Corner c2, int parand, G.Edge other = null, G.Edge other2 = null)
        {
            G.Line main  = new G.Line(mainPoint, mainEnd);
            G.Line side1 = new G.Line(side1Start, mainPoint);
            G.Line side2 = new G.Line(mainEnd, side2End);

            if (main.Length() < _V_.Y_REINFORCEMENT_MAIN_RADIUS * 1.99)
            {
                return(false);
            }

            //reinf_geometry_debug.Add(main);
            //reinf_geometry_debug.Add(side1);
            //reinf_geometry_debug.Add(side2);

            G.Vector v1 = main.getDirectionVector();
            G.Vector v2 = side1.getDirectionVector();
            G.Vector v3 = side2.getDirectionVector();

            double ang1 = G.Converter.AngleDeltaCW(v1, v2);
            double ang2 = G.Converter.AngleDeltaCW(v1, v3);

            bool d1 = Math.Abs(ang1 - Math.PI / 2) < _V_.M_B_BAR_TOLERANCE;
            bool d2 = Math.Abs(ang2 - 3 * Math.PI / 2) < _V_.M_B_BAR_TOLERANCE;

            if (d1 && d2)
            {
                R.D_Raud reinf = new R.D_Raud(main, side1, side2, _V_.X_REINFORCEMENT_NUMBER, _V_.X_REINFORCEMENT_MAIN_DIAMETER, _V_.X_REINFORCEMENT_MARK, parand);

                if (denier(reinf.makeMainLine()))
                {
                    return(false);
                }
                if (denier(reinf.makeSide1Line()))
                {
                    return(false);
                }
                if (denier(reinf.makeSide2Line()))
                {
                    return(false);
                }

                keep(reinf, e, c1, c2);
                keep_double(reinf, other);
                keep_double(reinf, other2);
            }
            else
            {
                R.E_Raud reinf = new R.E_Raud(main, side1, side2, _V_.X_REINFORCEMENT_NUMBER, _V_.X_REINFORCEMENT_MAIN_DIAMETER, _V_.X_REINFORCEMENT_MARK, parand);

                if (denier(reinf.makeMainLine()))
                {
                    return(false);
                }
                if (denier(reinf.makeSide1Line()))
                {
                    return(false);
                }
                if (denier(reinf.makeSide2Line()))
                {
                    return(false);
                }

                keep(reinf, e, c1, c2);
                keep_double(reinf, other);
                keep_double(reinf, other2);
            }

            return(true);
        }
        //B HANDLE
        private bool B_vs_C_handler(G.Point mainPoint, G.Point mainEnd, G.Point sideStart, G.Edge e, G.Corner oc)
        {
            G.Line main = new G.Line(mainPoint, mainEnd);
            G.Line side = new G.Line(sideStart, mainPoint);

            G.Line temp1 = trimLine_basepoint(main, mainPoint);
            if (temp1.Length() > main.Length() * _V_.M_TRIM_TOLERANCE)
            {
                main = temp1.Copy();
            }
            if (denier(main))
            {
                return(false);
            }

            G.Line temp2 = trimLine_basepoint(side, mainPoint);
            if (temp2.Length() > side.Length() * _V_.M_TRIM_TOLERANCE)
            {
                side = temp2.Copy();
            }
            if (denier(side))
            {
                return(false);
            }

            if (main.Length() < _V_.Y_REINFORCEMENT_MAIN_RADIUS)
            {
                return(false);
            }
            if (side.Length() < _V_.Y_REINFORCEMENT_MAIN_RADIUS)
            {
                return(false);
            }

            G.Vector v1 = main.getDirectionVector();
            G.Vector v2 = side.getDirectionVector();

            double ang = G.Converter.AngleDeltaCW(v1, v2);

            if (Math.Abs(ang - Math.PI / 2) < _V_.M_B_BAR_TOLERANCE)
            {
                R.B_Raud reinf = new R.B_Raud(main, side, _V_.X_REINFORCEMENT_NUMBER, _V_.X_REINFORCEMENT_MAIN_DIAMETER, _V_.X_REINFORCEMENT_MARK);
                keep(reinf, e, oc, null);
            }
            else
            {
                R.C_Raud reinf = new R.C_Raud(main, side, _V_.X_REINFORCEMENT_NUMBER, _V_.X_REINFORCEMENT_MAIN_DIAMETER, _V_.X_REINFORCEMENT_MARK);
                keep(reinf, e, oc, null);
            }

            return(true);
        }