Beispiel #1
0
        private bool insanityCheck()
        {
            for (int i = corners.Count - 1; i >= 0; i--)
            {
                Corner c = corners[i];

                if (Math.Abs(c.Angle - Math.PI) < _Variables.FLAT_CORNER_TOLERANCE)
                {
                    Edge start = c.StartEdge;
                    Edge end   = c.EndEdge;

                    Line   new_line = new Line(end.Line.Start, start.Line.End);
                    Point  center   = new_line.getCenterPoint();
                    Vector offset   = new_line.getOffsetVector();
                    Point  p        = center.move(_Variables.MOVE_DISTANCE, offset);
                    bool   inSide   = isPointinRegion(p);

                    if (inSide)
                    {
                        Edge e = new Edge(new_line);
                        edges.Add(e);
                        edges.Remove(start);
                        edges.Remove(end);

                        return(false);
                    }
                    else
                    {
                        throw new RegionLineNotInRegionException();
                    }
                }
            }

            return(true);
        }
Beispiel #2
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();
            }
        }
        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();
            }
        }
Beispiel #4
0
        private void setEdges(List <Line> contours)
        {
            foreach (Line line in contours)
            {
                Point  center = line.getCenterPoint();
                Vector offset = line.getOffsetVector();
                Vector dir    = line.getDirectionVector();
                Point  p      = center.move(_Variables.MOVE_DISTANCE, offset);
                p = p.move(_Variables.MOVE_DISTANCE, dir);
                bool inSide = Region_Static.isPointinRegion(p, offset, contours);

                if (inSide)
                {
                    Edge e = new Edge(line);
                    if (edges.Contains(e))
                    {
                        continue;
                    }

                    edges.Add(e);
                }
                else
                {
                    Line new_line = line.swapHandles();
                    center = new_line.getCenterPoint();
                    offset = new_line.getOffsetVector();
                    dir    = line.getDirectionVector();
                    p      = center.move(_Variables.MOVE_DISTANCE, offset);
                    p      = p.move(_Variables.MOVE_DISTANCE, dir);
                    inSide = Region_Static.isPointinRegion(p, offset, contours);

                    if (inSide)
                    {
                        Edge e = new Edge(new_line);
                        if (edges.Contains(e))
                        {
                            continue;
                        }

                        edges.Add(e);
                    }
                    else
                    {
                        throw new RegionLineNotInRegionException();
                    }
                }
            }
        }
Beispiel #5
0
        private bool narrow_denier(G.Edge e)
        {
            G.Line main = e.Line.Copy();

            G.Vector v1        = main.getOffsetVector();
            G.Point  cp        = main.getCenterPoint();
            G.Point  ep1       = main.Start.move(_V_.X_CONCRETE_COVER_1 * 2, v1);
            G.Point  ep2       = cp.move(_V_.X_CONCRETE_COVER_1 * 2, v1);
            G.Point  ep3       = main.End.move(_V_.X_CONCRETE_COVER_1 * 2, v1);
            G.Line   testLine1 = new G.Line(main.Start, ep1);
            G.Line   testLine2 = new G.Line(cp, ep2);
            G.Line   testLine3 = new G.Line(main.End, ep3);

            if (denier(testLine1, e) && denier(testLine2, e) && denier(testLine3, e))
            {
                return(true);
            }

            return(false);
        }
Beispiel #6
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);
                                }
                            }
                        }
                    }
                }
            }
        }