35 G4double cornerRadius,
38 G4double frac = cornerRadius / std::max(std::abs(x1), std::abs(y1));
45 G4double alpha = std::atan2(std::abs(x1), std::abs(y1));
46 G4double halfAngle = CLHEP::halfpi - alpha;
47 std::vector<G4TwoVector> topBit;
48 G4double nPointsTopDouble = (2*halfAngle/CLHEP::twopi) * pointsPerTwoPi;
49 G4int nPointsTop = std::max(4, (G4int)std::ceil(nPointsTopDouble));
50 G4double currentAngle = -halfAngle;
51 G4double dAngle = 2*halfAngle / (G4double)nPointsTop;
52 G4TwoVector rotationPointTop(0, y1-cornerRadius);
53 for (G4int i = 0; i <= nPointsTop; i++)
55 G4TwoVector r(0, cornerRadius);
56 r.rotate(-currentAngle);
57 topBit.push_back(rotationPointTop + r);
58 currentAngle += dAngle;
61 std::vector<G4TwoVector> rightBit;
62 G4double nPointsRightDouble = (2*alpha/CLHEP::twopi) * pointsPerTwoPi;
63 G4int nPointsRight = std::max(4, (G4int)std::ceil(nPointsRightDouble));
64 currentAngle = -alpha;
65 dAngle = 2*alpha / (G4double)nPointsRight;
66 G4TwoVector rotationPointRight(x1-cornerRadius, 0);
67 for (G4int i = 0; i <= nPointsRight; i++)
69 G4TwoVector r(cornerRadius, 0);
70 r.rotate(-currentAngle);
71 topBit.push_back(rotationPointRight + r);
72 currentAngle += dAngle;
75 for (
const auto& p : topBit)
77 for (
const auto& p : rightBit)
79 for (
const auto& p : topBit)
80 {vec.emplace_back(-p.x(), -p.y());}
81 for (
const auto& p : rightBit)
82 {vec.emplace_back(-p.x(), -p.y());}
83 std::reverse(vec.begin(), vec.end());
87 AppendPoint(vec, x1, 0);
88 AppendPoint(vec, 0, -y1);
89 AppendPoint(vec, -x1, 0);
90 AppendPoint(vec, 0, y1);
111 G4double beamPipeThickness,
112 G4int pointsPerTwoPi)
void GenerateRhombus(std::vector< G4TwoVector > &vec, G4double x1, G4double y1, G4double cornerRadius, G4int pointsPerTwoPi)
Generate either 4 points or set of points with curved edges.
virtual void GeneratePoints(G4double aper1, G4double aper2, G4double aper3, G4double aper4, G4double beamPipeThickness, G4int pointsPerTwoPi=40)
Generate all the sets of required points for each surface.
virtual G4double CalculateIntersectionRadius(G4double aper1, G4double aper2, G4double aper3, G4double aper4, G4double beamPipeThickness)
Calculate the radius of the solid used for intersection for angled faces.