9 inline Vector3D CylinderSurface::rotSymmetryAxis(
12 return transform(gctx).matrix().block<3, 1>(0, 2);
19 double R = bounds().get(CylinderBounds::eR);
22 const auto& tMatrix = transform.matrix();
23 Vector3D caxis = tMatrix.block<3, 1>(0, 2).transpose();
24 Vector3D ccenter = tMatrix.block<3, 1>(0, 3).transpose();
29 Vector3D ldXcd = direction.cross(caxis);
30 double a = ldXcd.dot(ldXcd);
31 double b = 2. * (ldXcd.dot(pcXcd));
32 double c = pcXcd.dot(pcXcd) - (R *
R);
40 const auto& gctxTransform =
transform(gctx);
43 auto qe = intersectionSolver(gctxTransform, position, direction);
46 if (qe.solutions == 0) {
51 Vector3D solution1 = position + qe.first * direction;
54 ? Intersection3D::Status::onSurface
55 : Intersection3D::Status::reachable;
64 const auto& cBounds = bounds();
65 if (cBounds.coversFullAzimuth() and
66 bcheck.
type() == BoundaryCheck::Type::eAbsolute) {
69 const auto& tMatrix = gctxTransform.matrix();
71 const Vector3D vecLocal(solution - tMatrix.block<3, 1>(0, 3));
72 double cZ = vecLocal.dot(tMatrix.block<3, 1>(0, 2));
74 double hZ = cBounds.get(CylinderBounds::eHalfLengthZ) +
tolerance;
75 return (cZ * cZ < hZ * hZ) ? status : Intersection3D::Status::missed;
77 return (isOnSurface(gctx, solution, direction, bcheck)
79 : Intersection3D::Status::missed);
86 if (qe.solutions == 1) {
90 Vector3D solution2 = position + qe.second * direction;
93 ? Intersection3D::Status::onSurface
94 : Intersection3D::Status::reachable;
99 bool check1 = status1 != Intersection3D::Status::missed or
100 (status1 == Intersection3D::Status::missed and
101 status2 == Intersection3D::Status::missed);
103 if ((check1 and qe.first * qe.first < qe.second * qe.second) or
104 status2 == Intersection3D::Status::missed) {
112 return cIntersection;
116 CylinderSurface::localCartesianToBoundLocalDerivative(
121 const auto& sTransform =
transform(gctx);
124 const double lr =
perp(localPos);
125 const double lphi =
phi(localPos);
126 const double lcphi =
std::cos(lphi);
127 const double lsphi = std::sin(lphi);
129 double R = bounds().get(CylinderBounds::eR);
131 LocalCartesianToBoundLocalMatrix::Zero();
132 loc3DToLocBound << -R * lsphi / lr, R * lcphi / lr, 0, 0, 0, 1;
134 return loc3DToLocBound;