File indexing completed on 2025-01-19 09:23:34
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Utilities/Intersection.hpp"
0013
0014
0015 namespace Acts::PlanarHelper {
0016
0017
0018
0019
0020
0021
0022
0023
0024 inline Intersection3D intersect(const Transform3& transform,
0025 const Vector3& position,
0026 const Vector3& direction,
0027 ActsScalar tolerance) {
0028
0029 const auto& tMatrix = transform.matrix();
0030 const Vector3 pnormal = tMatrix.block<3, 1>(0, 2).transpose();
0031 const Vector3 pcenter = tMatrix.block<3, 1>(0, 3).transpose();
0032
0033 ActsScalar denom = direction.dot(pnormal);
0034 if (denom != 0.0) {
0035
0036 ActsScalar path = (pnormal.dot((pcenter - position))) / (denom);
0037
0038 Intersection3D::Status status = std::abs(path) < std::abs(tolerance)
0039 ? Intersection3D::Status::onSurface
0040 : Intersection3D::Status::reachable;
0041
0042 return Intersection3D{(position + path * direction), path, status};
0043 }
0044 return Intersection3D::invalid();
0045 }
0046
0047 }