File indexing completed on 2025-01-18 09:11:03
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, double tolerance) {
0027
0028 const auto& tMatrix = transform.matrix();
0029 const Vector3 pnormal = tMatrix.block<3, 1>(0, 2).transpose();
0030 const Vector3 pcenter = tMatrix.block<3, 1>(0, 3).transpose();
0031
0032 double denom = direction.dot(pnormal);
0033 if (denom != 0.0) {
0034
0035 double path = (pnormal.dot((pcenter - position))) / (denom);
0036
0037 IntersectionStatus status = std::abs(path) < std::abs(tolerance)
0038 ? IntersectionStatus::onSurface
0039 : IntersectionStatus::reachable;
0040
0041 return Intersection3D{(position + path * direction), path, status};
0042 }
0043 return Intersection3D::invalid();
0044 }
0045
0046 }