Exemplo n.º 1
0
        public C_Raud(G.Line main, G.Line side, int nr, int d, string teras) : base(main, nr, d, teras)
        {
            G.Vector mainDir = main.getDirectionVector();
            G.Polar  mainPol = G.Converter.xy_to_la(mainDir);

            G.Vector sideDir = side.getDirectionVector();
            G.Polar  sidePol = G.Converter.xy_to_la(sideDir);

            _A = shorter(side.Length());
            _B = shorter(main.Length());
            _U = G.Converter.AngleDelta(mainPol.angle, sidePol.angle);

            _IP     = main.Start;
            _Length = _A + _B;

            //OVERRIDE
            G.Vector dir           = main.getDirectionVector();
            double   shorterLength = shorter(main.Length());

            _StartPoint = main.Start;
            _EndPoint   = _StartPoint.move(shorterLength, dir);
            //OVERRIDE

            G.Vector v1 = -1 * side.getDirectionVector();
            _SidePoint = _StartPoint.move(_A, v1);
        }
Exemplo n.º 2
0
        public static E_Raud mergeTwoRebar_long(C_Raud one, C_Raud two)
        {
            G.Point a = one._SidePoint;
            G.Point b = one.StartPoint;
            G.Point c = two.StartPoint;
            G.Point d = two._EndPoint;

            G.Line temp1 = new G.Line(a, b);
            G.Line main  = new G.Line(b, c);
            G.Line temp2 = new G.Line(c, d);

            double s1  = temp1.Length();
            double s2  = temp2.Length();
            double max = Math.Max(s1, s2);

            G.Vector v1 = (-1) * temp1.getDirectionVector();
            G.Vector v2 = temp2.getDirectionVector();

            G.Point new_a = b.move(max, v1);
            G.Point new_d = c.move(max, v2);

            G.Line side1 = new G.Line(new_a, b);
            G.Line side2 = new G.Line(c, new_d);

            E_Raud raud = new E_Raud(main, side1, side2, one.Number, one.Diameter, one.Materjal);

            return(raud);
        }
Exemplo n.º 3
0
        public E_Raud(G.Line main, G.Line side1, G.Line side2, int nr, int d, string teras, int parand = 0) : base(main, nr, d, teras)
        {
            G.Vector mainDir = main.getDirectionVector();
            G.Polar  mainPol = G.Converter.xy_to_la(mainDir);

            G.Vector sideDir1 = side1.getDirectionVector();
            G.Polar  sidePol1 = G.Converter.xy_to_la(sideDir1);

            G.Vector sideDir2 = side2.getDirectionVector();
            G.Polar  sidePol2 = G.Converter.xy_to_la(sideDir2);

            _A  = shorter(side1.Length());
            _B  = shorter(main.Length());
            _B2 = shorter(main.Length() + parand); // parand magic
            _C  = shorter(side2.Length());

            G.Vector perpendVector = mainDir.rotate(-Math.PI / 2);
            double   maxDist       = Math.Max(_A, _C) * 2;

            G.Line mainExtended = main.extendDouble(maxDist);

            G.Point movePoint1   = side1.Start.move(maxDist, perpendVector);
            G.Line  perpendLine1 = new G.Line(side1.Start, movePoint1);
            G.Point interPoint1  = G.Line.getIntersectionPoint(mainExtended, perpendLine1);
            G.Line  XLine        = new G.Line(side1.Start, interPoint1);

            G.Point movePoint2   = side2.End.move(maxDist, perpendVector);
            G.Line  perpendLine2 = new G.Line(side2.End, movePoint2);
            G.Point interPoint2  = G.Line.getIntersectionPoint(mainExtended, perpendLine2);
            G.Line  YLine        = new G.Line(side2.End, interPoint2);

            _U = G.Converter.AngleDelta(mainPol.angle, sidePol1.angle);
            _V = G.Converter.AngleDelta(mainPol.angle, sidePol2.angle);
            _X = XLine.Length();
            _Y = YLine.Length();

            _IP     = main.getCenterPoint();
            _Length = _A + _B2 + _C; // parand magic

            G.Vector v1 = -1 * side1.getDirectionVector();
            _Side1Point = _StartPoint.move(_A, v1);

            G.Vector v2 = side2.getDirectionVector();
            _Side2Point = _EndPoint.move(_C, v2);
        }
Exemplo n.º 4
0
        private void define_side_D(LineSegment seg)
        {
            G.Line ln         = seg.getLine();
            G.Line offsetLine = ln.Offset(_V_.X_CONCRETE_COVER_1);

            G.Vector d1 = ln.getDirectionVector();
            G.Vector o1 = ln.getOffsetVector();

            double absX = Math.Abs(o1.X);
            double absY = Math.Abs(o1.Y);

            G.Vector absV = new G.Vector(absX, absY);
            G.Polar  p    = G.Converter.xy_to_la(absV);

            int spacing;
            int distance;
            int parand; // parand magic

            if (p.angle < Math.PI / 4)
            {
                spacing  = _V_.X_REINFORCEMENT_SIDE_D_SPACING;
                distance = _V_.X_REINFORCEMENT_SIDE_D_ANCHOR_LENGTH;
                parand   = _V_.X_REINFORCEMENT_SIDE_D_FIX;
            }
            else
            {
                spacing  = _V_.X_REINFORCEMENT_TOP_D_SPACING;
                distance = _V_.X_REINFORCEMENT_TOP_D_ANCHOR_LENGTH;
                parand   = _V_.X_REINFORCEMENT_TOP_D_FIX;
            }

            double nearEdge    = _V_.X_CONCRETE_COVER_1 * 2.5;
            double equalSpacer = ((ln.Length() - 2 * nearEdge) % spacing) / 2;

            double j   = nearEdge + equalSpacer;
            double len = ln.Length();

            if ((len - nearEdge * 2) > spacing)
            {
                R.Raud_Array rauad = new R.Raud_Array(spacing);
                knownArrayReinforcement.Add(rauad);

                while (j < len)
                {
                    G.Point start = offsetLine.Start.move(j, d1);
                    G.Point end   = start.move(distance, o1);

                    D_side_handler(start, end, parand); // parand magic
                    j = j + spacing;
                }

                D_side_garbage_collector();
            }
        }
        //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);
        }
        private void define_side_U(LineSegment seg)
        {
            G.Line mainLine  = seg.getLine();
            G.Line otherLine = seg.getOtherLine();

            if (setLineSegment.Contains(seg))
            {
                return;
            }
            if (isLineRight(mainLine) == false && isLineRight(otherLine) == true)
            {
                return;
            }

            G.Vector d1      = mainLine.getDirectionVector();
            G.Vector o1      = mainLine.getOffsetVector();
            int      spacing = _V_.X_REINFORCEMENT_STIRRUP_SPACING;

            double nearEdge    = _V_.X_CONCRETE_COVER_1 * 1.2;
            double equalSpacer = ((mainLine.Length() - 2 * nearEdge) % spacing) / 2;

            double j   = nearEdge + equalSpacer;
            double len = mainLine.Length();

            if ((len - nearEdge * 2) > spacing)
            {
                R.Raud_Array rauad = new R.Raud_Array(spacing);
                knownArrayReinforcement.Add(rauad);

                while (j < len)
                {
                    G.Point start    = mainLine.Start.move(j, d1);
                    G.Point extended = start.move(_V_.Y_STIRRUP_MAX_LENGTH * 1.1, o1);
                    G.Line  temp     = new G.Line(start, extended);
                    G.Point end      = G.Line.getIntersectionPoint(temp, otherLine);

                    temp = new G.Line(start, end);

                    if (Math.Round(temp.Length(), 0) > _V_.X_CONCRETE_COVER_1 * 2)
                    {
                        temp = temp.extendDouble(-1 * _V_.X_CONCRETE_COVER_1);

                        U_side_handler(temp.Start, temp.End, seg);
                    }

                    j = j + spacing;
                }

                U_side_garbage_collector();
            }
        }
        //definer
        private bool D_side_handler(G.Point start, G.Point end, int parand)
        {
            G.Line side = new G.Line(start, end);

            if (denier(side))
            {
                return(false);
            }

            //reinf_geometry_debug.Add(side);

            G.Vector o1   = side.getDirectionVector();
            double   absX = Math.Abs(o1.X);
            double   absY = Math.Abs(o1.Y);

            G.Vector absV = new G.Vector(absX, absY);
            G.Polar  p    = G.Converter.xy_to_la(absV);

            R.D_Raud cur;
            if (p.angle < Math.PI / 4)
            {
                if (_V_.X_REINFORCEMENT_SIDE_D_CREATE == 1)
                {
                    cur = new R.D_Raud(side, _V_.Y_ELEMENT_WIDTH_COVER + parand, 1, _V_.X_REINFORCEMENT_SIDE_D_DIAMETER, _V_.X_REINFORCEMENT_MARK);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                if (_V_.X_REINFORCEMENT_TOP_D_CREATE == 1)
                {
                    cur = new R.D_Raud(side, _V_.Y_ELEMENT_WIDTH_COVER + parand, 1, _V_.X_REINFORCEMENT_TOP_D_DIAMETER, _V_.X_REINFORCEMENT_MARK);
                }
                else
                {
                    return(false);
                }
            }

            int currentIndex = knownArrayReinforcement.Count - 1;

            knownArrayReinforcement[currentIndex].add_one(cur);
            keep_array(cur, null);

            return(true);
        }
        private bool AB_handler_replace_side(R.A_Raud a, R.B_Raud b)
        {
            G.Line t1 = a.makeLine();
            G.Line t2 = b.makeMainLine();
            G.Line t3 = b.makeSideLine();

            G.Line new_a_line = new G.Line(a.StartPoint, b.IP);

            G.Point new_b_start = t2.Start.move(_V_.Y_CONCRETE_COVER_DELTA, t2.getDirectionVector());
            G.Point new_b_end   = t2.End.move(_V_.Y_CONCRETE_COVER_DELTA, t2.getDirectionVector());

            G.Point new_b_side_point = new_b_start.move(_V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH, (-1) * t3.getDirectionVector());

            G.Line new_b_side_line = new G.Line(new_b_side_point, new_b_start);
            G.Line new_b_main_line = new G.Line(new_b_start, new_b_end);

            R.A_Raud new_A = new R.A_Raud(new_a_line, a.Number, a.Diameter, a.Materjal);
            R.B_Raud new_B = new R.B_Raud(new_b_main_line, new_b_side_line, b.Number, b.Diameter, b.Materjal);

            if (denier(new_A.makeLine()))
            {
                return(false);
            }
            if (denier(new_B.makeSideLine()))
            {
                return(false);
            }
            if (denier(new_B.makeMainLine()))
            {
                return(false);
            }

            keep_replace(new_A, new_B, a, b);

            return(true);
        }
Exemplo n.º 9
0
        public D_Raud(G.Line main, G.Line side1, G.Line side2, int nr, int d, string teras, int parand = 0) : base(main, nr, d, teras)
        {
            _A  = shorter(side1.Length());
            _B  = shorter(main.Length());
            _B2 = shorter(main.Length() + parand); // parand magic
            _C  = shorter(side2.Length());

            _IP     = main.getCenterPoint();
            _Length = _A + _B2 + _C; // parand magic

            G.Vector v1 = -1 * side1.getDirectionVector();
            _Side1Point = _StartPoint.move(_A, v1);

            G.Vector v2 = side2.getDirectionVector();
            _Side2Point = _EndPoint.move(_C, v2);
        }
Exemplo n.º 10
0
        public bool isInBounds(Line target)
        {
            Vector v = target.getDirectionVector();
            Polar  p = Converter.xy_to_la(v);

            Line projected_line = target.rotation(this, p.angle);

            if (this.X < projected_line.Start.X)
            {
                return(false);
            }
            if (this.X > projected_line.End.X)
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 11
0
        public Raud(G.Line main, int nr, int d, string teras)
        {
            G.Vector dir = main.getDirectionVector();
            G.Polar  pol = G.Converter.xy_to_la(dir);

            _Rotation = G.Converter.Wrap(pol.angle, Math.PI * 2, 0.0);

            _Number   = nr;
            _Diameter = d;
            _Materjal = teras;

            double shorterLength  = shorter(main.Length());
            double originalLength = main.Length();
            double delta          = (originalLength - shorterLength) / 2;

            _StartPoint = main.Start.move(delta, dir);
            _EndPoint   = _StartPoint.move(shorterLength, dir);
        }
Exemplo n.º 12
0
        public B_Raud(G.Line main, G.Line side, int nr, int d, string teras) : base(main, nr, d, teras)
        {
            _A = shorter(side.Length());
            _B = shorter(main.Length());

            _IP     = main.Start;
            _Length = _A + _B;

            //OVERRIDE
            G.Vector dir           = main.getDirectionVector();
            double   shorterLength = shorter(main.Length());

            _StartPoint = main.Start;
            _EndPoint   = _StartPoint.move(shorterLength, dir);
            //OVERRIDE

            G.Vector v1 = -1 * side.getDirectionVector();
            _SidePoint = _StartPoint.move(_A, v1);
        }
Exemplo n.º 13
0
        private bool isLineRight(G.Line ln)
        {
            G.Vector v = ln.getDirectionVector();

            double absX = Math.Abs(v.X);
            double absY = Math.Abs(v.Y);

            G.Vector absV = new G.Vector(absX, absY);
            G.Polar  p    = G.Converter.xy_to_la(absV);

            double remain = p.angle % (Math.PI / 4);

            if (remain < 0.1)
            {
                return(true);
            }

            return(false);
        }
Exemplo n.º 14
0
        private G.Line trimLine_basepoint(G.Line extendedLine, G.Point fixedPoint, double offset, G.Edge e, ref G.Edge trimmer)
        {
            G.Line trimmedLine = extendedLine.Copy();

            foreach (G.Edge eg in allEdges)
            {
                if (eg.Line.getOffsetVector() == e.Line.getOffsetVector())
                {
                    continue;
                }
                if (e.StartCorner.getOtherEdge(e) == eg && e.StartCorner.Angle > Math.PI)
                {
                    continue;
                }
                if (e.EndCorner.getOtherEdge(e) == eg && e.EndCorner.Angle > Math.PI)
                {
                    continue;
                }
                if (trimmedLine.getDirectionVector() == eg.Line.getDirectionVector())
                {
                    continue;
                }
                if (trimmedLine.getDirectionVector() == (-1) * eg.Line.getDirectionVector())
                {
                    continue;
                }

                double o  = offset - _V_.X_TRIM_MINIMUM_DELTA;
                double so = _V_.X_CONCRETE_COVER_1 - _V_.X_TRIM_SIDE_MINIMUM_DELTA;

                if (e.StartCorner.getOtherEdge(e) == eg)
                {
                    o = so;
                }
                if (e.EndCorner.getOtherEdge(e) == eg)
                {
                    o = so;
                }

                G.Line offsetLine = eg.edgeTrimmer(o, so, so);

                if (G.Line.hasIntersection(trimmedLine, offsetLine))
                {
                    G.Point ip = G.Line.getIntersectionPoint(trimmedLine, offsetLine);

                    if (ip == fixedPoint)
                    {
                        continue;
                    }

                    if (fixedPoint == extendedLine.End)
                    {
                        trimmedLine = new G.Line(ip, extendedLine.End);
                    }
                    else
                    {
                        trimmedLine = new G.Line(extendedLine.Start, ip);
                    }

                    trimmer = eg;
                }
            }

            return(trimmedLine);
        }
Exemplo n.º 15
0
        //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);
        }