public Vector getOffsetVector() { Vector unit = getDirectionVector(); Vector u90 = unit.rotate(Math.PI / 2); return(u90); }
public Vector getBottomVector(Vector one) { Vector other = getDirectionVector(); if (Converter.AngleDeltaCW(other, one) > Math.PI) { other = other.rotate(Math.PI); } return(other); }
public Line rotation(Point startPoint, double angle) { Vector a_s = new Vector(Start.X - startPoint.X, Start.Y - startPoint.Y); a_s = a_s.rotate(angle); Vector a_e = new Vector(End.X - startPoint.X, End.Y - startPoint.Y); a_e = a_e.rotate(angle); Point new_start = new Point(a_s.X, a_s.Y); Point new_end = new Point(a_e.X, a_e.Y); Line projection = new Line(new_start, new_end); return(projection); }
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); }
private void diagonalRotater(G.Point centerPoint, G.Vector v3, double n, double m, ref G.Line tester) { if (n > 6) { return; } double deg5 = 0.0872665; double rot = deg5 * n * m; v3 = v3.rotate(rot); tester = new G.Line(centerPoint, _V_.X_REINFORCEMENT_DIAGONAL_ANCHOR_LENGTH, v3); if (denier(tester)) { n = n + 1; m = m * -1; diagonalRotater(centerPoint, v3, n, m, ref tester); } else { return; } }