13 inline const Vector3D CylinderSurface::rotSymmetryAxis(
16 return transform(gctx).matrix().block<3, 1>(0, 2);
23 double R = bounds().get(CylinderBounds::eR);
26 const auto& tMatrix = transform.matrix();
27 Vector3D caxis = tMatrix.block<3, 1>(0, 2).transpose();
28 Vector3D ccenter = tMatrix.block<3, 1>(0, 3).transpose();
33 Vector3D ldXcd = direction.cross(caxis);
34 double a = ldXcd.dot(ldXcd);
35 double b = 2. * (ldXcd.dot(pcXcd));
36 double c = pcXcd.dot(pcXcd) - (R *
R);
44 const auto& gctxTransform =
transform(gctx);
46 auto qe = intersectionSolver(gctxTransform, position, direction);
49 if (qe.solutions == 0) {
55 qe.first * qe.first < qe.second * qe.second ? qe.first : qe.second;
56 Vector3D solution = position + path * direction;
59 ? Intersection::Status::onSurface
60 : Intersection::Status::reachable;
63 if (bcheck and not isOnSurface(gctx, solution, direction, bcheck)) {
64 status = Intersection::Status::missed;
74 const auto& gctxTransform =
transform(gctx);
77 auto qe = intersectionSolver(gctxTransform, position, direction);
80 if (qe.solutions == 0) {
85 Vector3D solution1 = position + qe.first * direction;
88 ? Intersection::Status::onSurface
89 : Intersection::Status::reachable;
98 const auto& cBounds = bounds();
99 if (cBounds.coversFullAzimuth() and
100 bcheck.
type() == BoundaryCheck::Type::eAbsolute) {
103 const auto& tMatrix = gctxTransform.matrix();
105 const Vector3D vecLocal(solution - tMatrix.block<3, 1>(0, 3));
106 double cZ = vecLocal.dot(tMatrix.block<3, 1>(0, 2));
108 double hZ = cBounds.get(CylinderBounds::eHalfLengthZ) + tolerance;
109 return (cZ * cZ < hZ * hZ) ? status : Intersection::Status::missed;
111 return (isOnSurface(gctx, solution, direction, bcheck)
113 : Intersection::Status::missed);
120 if (qe.solutions == 1) {
121 return cIntersection;
124 Vector3D solution2 = position + qe.second * direction;
127 ? Intersection::Status::onSurface
128 : Intersection::Status::reachable;
133 bool check1 = status1 != Intersection::Status::missed or
134 (status1 == Intersection::Status::missed and
135 status2 == Intersection::Status::missed);
137 if ((check1 and qe.first * qe.first < qe.second * qe.second) or
138 status2 == Intersection::Status::missed) {
146 return cIntersection;