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); }
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 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"); }
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"); }
public Line extendEnd(double dist) { Vector dir = getDirectionVector(); Point new_end = End.move(dist, dir); Point new_start = new Point(Start.X, Start.Y); Line new_line = new Line(new_start, new_end); return(new_line); }
public Line extendStart(double dist) { Vector dir = -1 * getDirectionVector(); Point new_start = Start.move(dist, dir); Point new_end = new Point(End.X, End.Y); Line new_line = new Line(new_start, new_end); return(new_line); }
public Line(Point Center, double distance, Vector v1) { this.Start = Center.move(distance, v1); this.End = Center.move(distance, -1 * v1); if (this.Start == this.End) { throw new LineSamePointException(); } }
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); }
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(); } } } }
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 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); }
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 static bool isPointinRegion(Point pa, Vector v, List <Line> contours) { double min_X = double.MaxValue; double max_X = double.MinValue; double min_Y = double.MaxValue; double max_Y = double.MinValue; find_boundries(contours, ref min_X, ref max_X, ref min_Y, ref max_Y); if (pa.X < min_X) { return(false); } if (pa.X > max_X) { return(false); } if (pa.Y < min_Y) { return(false); } if (pa.Y > max_Y) { return(false); } double dX = Math.Abs(max_X - min_X); double dY = Math.Abs(max_Y - min_Y); double dL = (dX + dY) * 2; double new_X = (pa.X + dX) * 5; double new_Y = pa.Y; Point pe = pa.move(dL, v); Line testLine = new Line(pa, pe); int i = 0; foreach (Line contour in contours) { bool inter = Line.hasIntersection(testLine, contour); if (inter) { i++; } } if (i == 0) { return(false); } bool answer = (i % 2 != 0); return(answer); }
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 B_Raud_Init_test2() { G.Point start = new G.Point(2.0, 2.0); G.Point mainp = start.move(5, new G.Vector(1, 1)); G.Point sidep = start.move(10, new G.Vector(-1, 1)); G.Line main = new G.Line(start, mainp); G.Line side = new G.Line(sidep, start); R.B_Raud reinf = new R.B_Raud(main, side, 2, 8, "B500B"); Assert.AreEqual(reinf.StartPoint.X, 2.0, 0.001); Assert.AreEqual(reinf.StartPoint.Y, 2.0, 0.001); Assert.AreEqual(reinf.Rotation, Math.PI / 4, 0.001); Assert.AreEqual(reinf.A, 10, 0.001); Assert.AreEqual(reinf.B, 5, 0.001); Assert.AreEqual(reinf.Length, 15.0, 0.001); Assert.AreEqual(reinf.Diameter, 8, 0.001); Assert.AreEqual(reinf.Materjal, "B500B"); }
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(); } }
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); } } }
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); }
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); }
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); } }
private bool AB_handler_replace_main(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(b.IP, a.EndPoint); G.Point new_b_side_point = t3.Start.move(_V_.Y_CONCRETE_COVER_DELTA, (-1) * t3.getDirectionVector()); G.Point new_b_start = t3.End.move(_V_.Y_CONCRETE_COVER_DELTA, (-1) * t3.getDirectionVector()); G.Point new_b_end = new_b_start.move(_V_.X_REINFORCEMENT_MAIN_ANCHOR_LENGTH, t2.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); }
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); }
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); }
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); }