private G.Line trimLine_basepoint(G.Line extendedLine, G.Point fixedPoint) // this function is used by B vs C handler and does not know what edge it belongs to. Hence the 0.01 tambov { G.Line trimmedLine = extendedLine.Copy(); foreach (G.Edge eg in allEdges) { double o = _V_.X_CONCRETE_COVER_1 - _V_.X_TRIM_MINIMUM_DELTA; G.Line offsetLine = eg.edgeOffset(o, o, o); if (G.Line.hasIntersection(trimmedLine, offsetLine)) { G.Point ip = G.Line.getIntersectionPoint(trimmedLine, offsetLine); if (fixedPoint == extendedLine.End) { trimmedLine = new G.Line(ip, extendedLine.End); } else { trimmedLine = new G.Line(extendedLine.Start, ip); } } } return(trimmedLine); }
public void D_Raud_Init_test_parand2() { G.Point start = new G.Point(0.0, 0.0); G.Point mainp = start.move(25, new G.Vector(1, 0)); G.Point side1p = start.move(10, new G.Vector(0, 1)); G.Point side2p = mainp.move(15, new G.Vector(0, 1)); G.Line main = new G.Line(start, mainp); G.Line side1 = new G.Line(side1p, start); G.Line side2 = new G.Line(mainp, side2p); R.D_Raud reinf = new R.D_Raud(main, side1, side2, 2, 8, "B500B", -20); Assert.AreEqual(reinf.StartPoint.X, 0.0, 0.001); Assert.AreEqual(reinf.StartPoint.Y, 0.0, 0.001); Assert.AreEqual(reinf.Rotation, 0.0, 0.001); Assert.AreEqual(reinf.A, 10, 0.001); Assert.AreEqual(reinf.B, 25, 0.001); Assert.AreEqual(reinf.B2, 5, 0.001); Assert.AreEqual(reinf.C, 15, 0.001); Assert.AreEqual(reinf.Length, 30, 0.001); Assert.AreEqual(reinf.Diameter, 8, 0.001); Assert.AreEqual(reinf.Materjal, "B500B"); }
private void create_diagonal_A() { List <G.Corner> emptyCorners = allCorners.Where(x => !setCorners.Keys.Contains(x)).ToList(); foreach (G.Corner ec in emptyCorners) { G.Edge se = ec.StartEdge; G.Edge ee = ec.EndEdge; bool c1 = setEdges.Keys.Contains(se) && setEdges.Keys.Contains(ee); bool c2 = ec.Angle > Math.PI; if (c1 && c2) { G.Vector v1 = se.Line.getOffsetVector(); G.Vector v2 = ee.Line.getOffsetVector(); G.Vector v3 = (v1 + v2).rotate(Math.PI / 2); G.Point centerPoint = ec.getCornerPoint(se, _V_.X_CONCRETE_COVER_1, _V_.X_CONCRETE_COVER_1); G.Line tester = new G.Line(centerPoint, _V_.X_REINFORCEMENT_DIAGONAL_ANCHOR_LENGTH, v3); if (denier(tester)) { diagonalRotater(centerPoint, v3, 1, 1, ref tester); } A_handler(tester.Start, tester.End, null, ec, _V_.X_REINFORCEMENT_DIAGONAL_DIAMETER); } } }
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); }
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); }
private void create_all_A() { 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) { if (narrow_denier(e)) { continue; } G.Line main = e.edgeOffset(_V_.X_CONCRETE_COVER_1, _V_.X_CONCRETE_COVER_1, _V_.X_CONCRETE_COVER_1); if (e.StartCorner.Angle > Math.PI) { main = main.extendStart(_V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH); } if (e.EndCorner.Angle > Math.PI) { main = main.extendEnd(_V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH); } A_handler(main.Start, main.End, e, null, _V_.X_REINFORCEMENT_MAIN_DIAMETER); } }
public void E_Raud_Init_test1() { G.Point start = new G.Point(0.0, 0.0); G.Point mainp = start.move(5, new G.Vector(1, 0)); G.Point side1p = start.move(10, new G.Vector(-1, 1)); G.Point side2p = mainp.move(15, new G.Vector(1, 1)); G.Line main = new G.Line(start, mainp); G.Line side1 = new G.Line(side1p, start); G.Line side2 = new G.Line(mainp, side2p); R.E_Raud reinf = new R.E_Raud(main, side1, side2, 2, 8, "B500B"); Assert.AreEqual(reinf.StartPoint.X, 0.0, 0.001); Assert.AreEqual(reinf.StartPoint.Y, 0.0, 0.001); Assert.AreEqual(reinf.Rotation, 0.0, 0.001); Assert.AreEqual(reinf.A, 10, 0.001); Assert.AreEqual(reinf.B, 5, 0.001); Assert.AreEqual(reinf.C, 15, 0.001); Assert.AreEqual(reinf.U, Math.PI / 4, 0.001); Assert.AreEqual(reinf.V, Math.PI / 4, 0.001); Assert.AreEqual(reinf.X, 7.071, 0.001); Assert.AreEqual(reinf.Y, 10.606, 0.001); Assert.AreEqual(reinf.Length, 30, 0.001); Assert.AreEqual(reinf.Diameter, 8, 0.001); Assert.AreEqual(reinf.Materjal, "B500B"); }
public A_Raud(G.Line main, int nr, int d, string teras) : base(main, nr, d, teras) { _A = shorter(main.Length()); _IP = main.getCenterPoint(); _Length = _A; }
public G.Line makeLine() { G.Point a = new G.Point(_StartPoint.X, _StartPoint.Y); G.Point b = new G.Point(_EndPoint.X, _EndPoint.Y); G.Line rebarLine = new G.Line(a, b); return(rebarLine); }
public void D_Raud_Init_test3() { G.Point start = new G.Point(6.0, 2.0); G.Point mainp = start.move(5, new G.Vector(1, -1)); G.Point side1p = start.move(10, new G.Vector(1, 1)); G.Point side2p = mainp.move(15, new G.Vector(1, 1)); G.Line main = new G.Line(start, mainp); G.Line side1 = new G.Line(side1p, start); G.Line side2 = new G.Line(mainp, side2p); R.D_Raud reinf = new R.D_Raud(main, side1, side2, 2, 8, "B500B"); Assert.AreEqual(reinf.StartPoint.X, 6.0, 0.001); Assert.AreEqual(reinf.StartPoint.Y, 2.0, 0.001); Assert.AreEqual(reinf.Rotation, Math.PI + 3 * Math.PI / 4, 0.001); Assert.AreEqual(reinf.A, 10, 0.001); Assert.AreEqual(reinf.B, 5, 0.001); Assert.AreEqual(reinf.C, 15, 0.001); Assert.AreEqual(reinf.Length, 30, 0.001); Assert.AreEqual(reinf.Diameter, 8, 0.001); Assert.AreEqual(reinf.Materjal, "B500B"); }
private bool trimmer_basepoint(G.Line extendedLine, G.Point fixedPoint, ref G.Edge trimmer) { bool trimmed = false; G.Line trimmedLine = extendedLine.Copy(); foreach (G.Edge eg in allEdges) { G.Line offsetLine = eg.edgeOffset(0, 0, 0); if (G.Line.hasIntersection(trimmedLine, offsetLine)) { G.Line interLine = eg.edgeOffset(0, 0, 0); G.Point ip = G.Line.getIntersectionPoint(trimmedLine, interLine); if (fixedPoint == extendedLine.End) { trimmedLine = new G.Line(ip, extendedLine.End); } else { trimmedLine = new G.Line(extendedLine.Start, ip); } trimmed = true; trimmer = eg; } } return(trimmed); }
private void draw_line(G.Line ln, Pen ppp, PaintEventArgs e) { int x1 = (Convert.ToInt32(ln.Start.X) / scale) - nullX; int y1 = (-Convert.ToInt32(ln.Start.Y) / scale) + nullY; int x2 = (Convert.ToInt32(ln.End.X) / scale) - nullX; int y2 = (-Convert.ToInt32(ln.End.Y) / scale) + nullY; e.Graphics.DrawLine(ppp, x1, y1, x2, y2); }
public D_Raud(G.Line side1, int z_dist, int nr, int d, string teras) : base(side1, nr, d, teras) { _A = shorter(side1.Length()); _B = shorter(z_dist); // parand magic _B2 = _B; // parand magic _C = shorter(side1.Length()); _IP = side1.getCenterPoint(); _Length = _A + _B + _C; }
public static A_Raud mergeTwoRebar(A_Raud one, A_Raud two) { G.Line a = one.makeLine(); G.Line b = two.makeLine(); G.Line new_line = G.Line.merge(a, b); A_Raud raud = new A_Raud(new_line, one.Number, one.Diameter, one.Materjal); return(raud); }
//DEBUG private bool A_handler_debug(G.Point mainPoint, G.Point mainEnd) { G.Line main = new G.Line(mainPoint, mainEnd); reinf_geometry_debug.Add(main); R.A_Raud reinf = new R.A_Raud(main, _V_.X_REINFORCEMENT_NUMBER, _V_.X_REINFORCEMENT_MAIN_DIAMETER, _V_.X_REINFORCEMENT_MARK); keep(reinf, null, null, null); return(true); }
private List <LineSegment> line_segmentator(G.Edge e) { List <LineSegment> tempList = new List <LineSegment>(); List <LineSegment> segmentList = new List <LineSegment>(); G.Line main = e.Line.Offset(G._Variables.EQUALS_TOLERANCE + 0.001); G.Vector d1 = e.Line.getDirectionVector(); G.Vector o1 = e.Line.getOffsetVector(); double delta = _V_.M_LINE_SEGMENTATOR_STEP; double j = 1; double len = main.Length() - (j * 2); while (j < len) { G.Point checkStartPoint = main.Start.move(j, d1); G.Point checkEndPoint = checkStartPoint.move(_V_.Y_STIRRUP_MAX_LENGTH, o1); G.Line checkLine = new G.Line(checkStartPoint, checkEndPoint); G.Edge trimmerEdge = null; bool check = trimmer_basepoint(checkLine, checkStartPoint, ref trimmerEdge); if (tempList.Count == 0) { LineSegment temp = new LineSegment(checkStartPoint, e, trimmerEdge); tempList.Add(temp); } else { if (tempList[tempList.Count - 1].compareSegments(trimmerEdge)) { tempList[tempList.Count - 1].updateSegment(checkStartPoint); } else { LineSegment temp = new LineSegment(checkStartPoint, e, trimmerEdge); tempList.Add(temp); } } j = j + delta; } foreach (LineSegment temp in tempList) { if (temp.checkValid()) { segmentList.Add(temp); } } return(segmentList); }
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(); } }
public void A_Raud_class_test() { G.Point start = new G.Point(0.0, 0.0); G.Point end = new G.Point(10.0, 0.0); G.Line line = new G.Line(start, end); R.A_Raud reinf = new R.A_Raud(line, 2, 8, "B500B"); Assert.IsTrue(reinf is R.Raud); Assert.IsTrue(reinf is R.A_Raud); }
public G.Point getCornerPoint(G.Edge e, double offset_main, double offset_side, double alfa = 100000) { G.Line startLine = e.Line.Offset(offset_main); G.Line otherLine = getOtherEdge(e).Line.Offset(offset_side); G.Line extendedStart = startLine.extendDouble(alfa); G.Line extendedOther = otherLine.extendDouble(alfa); G.Point ip = G.Line.getIntersectionPoint(extendedStart, extendedOther); return(ip); }
//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 bool denier(G.Line final) { foreach (G.Edge eg in allEdges) { double o = _V_.X_CONCRETE_COVER_1 - _V_.X_DENIER_MINIMUM_DELTA; G.Line offsetLine = eg.edgeOffset(o, o, o); if (G.Line.hasIntersection(final, offsetLine)) { return(true); } } return(false); }
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(); } }
public void C_Raud_class_test() { G.Point start = new G.Point(0.0, 0.0); G.Point mainp = start.move(10.0, new G.Vector(1, 0)); G.Point sidep = start.move(10.0, new G.Vector(-1, 1)); G.Line main = new G.Line(start, mainp); G.Line side = new G.Line(sidep, start); R.C_Raud reinf = new R.C_Raud(main, side, 2, 8, "B500B"); Assert.IsTrue(reinf is R.Raud); Assert.IsTrue(reinf is R.C_Raud); }
//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); }
//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 static E_Raud mergeTwoRebar(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 side1 = new G.Line(a, b); G.Line main = new G.Line(b, c); G.Line side2 = new G.Line(c, d); E_Raud raud = new E_Raud(main, side1, side2, one.Number, one.Diameter, one.Materjal); return(raud); }
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); }
public void D_Raud_class_test() { G.Point start = new G.Point(0.0, 0.0); G.Point mainp = start.move(5, new G.Vector(1, 0)); G.Point side1p = start.move(10.0, new G.Vector(0, 1)); G.Point side2p = mainp.move(15, new G.Vector(0, 1)); G.Line main = new G.Line(start, mainp); G.Line side1 = new G.Line(side1p, start); G.Line side2 = new G.Line(mainp, side2p); R.D_Raud reinf = new R.D_Raud(main, side1, side2, 2, 8, "B500B"); Assert.IsTrue(reinf is R.Raud); Assert.IsTrue(reinf is R.D_Raud); }
public U_Raud(G.Line side1, int z_dist, int nr, int d, string teras) : base(side1, nr, d, teras) { if (d > 16) { _A = shorter(d * 14.5); } else { _A = shorter(d * 13); } _B = shorter(z_dist); _C = shorter(side1.Length()); _IP = side1.getCenterPoint(); _Length = _A + _B + _C; }
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); }