File indexing completed on 2025-08-03 07:48:34
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "Acts/Utilities/detail/TransformComparator.hpp"
0010
0011 namespace Acts::detail {
0012 TransformComparator::TransformComparator(const double transTolerance,
0013 const double rotTolerance)
0014 : m_tolTrans{transTolerance}, m_tolRot{rotTolerance} {}
0015 int TransformComparator::compare(const Acts::RotationMatrix3& a,
0016 const Acts::RotationMatrix3& b) const {
0017 const Acts::Vector3 anglesA = a.eulerAngles(2, 1, 0);
0018 const Acts::Vector3 anglesB = b.eulerAngles(2, 1, 0);
0019 for (int i = 0; i < 3; ++i) {
0020 const double diff = anglesA[i] - anglesB[i];
0021 if (std::abs(diff) > m_tolRot) {
0022 return diff > 0 ? 1 : -1;
0023 }
0024 }
0025 return 0;
0026 }
0027 int TransformComparator::compare(const Acts::Transform3& a,
0028 const Acts::Transform3& b) const {
0029 if (const int tCmp = compare<3>(a.translation(), b.translation());
0030 tCmp != 0) {
0031 return tCmp;
0032 }
0033 return compare(a.rotation(), b.rotation());
0034 }
0035 bool TransformComparator::operator()(const Acts::Transform3& a,
0036 const Acts::Transform3& b) const {
0037 return compare(a, b) < 0;
0038 }
0039 bool TransformComparator::operator()(const Acts::RotationMatrix3& a,
0040 const RotationMatrix3& b) const {
0041 return compare(a, b) < 0;
0042 }
0043 bool TransformComparator::operator()(const Acts::Vector3& a,
0044 const Acts::Vector3& b) const {
0045 return compare<3>(a, b) < 0;
0046 }
0047 bool TransformComparator::operator()(const Acts::Vector2& a,
0048 const Acts::Vector2& b) const {
0049 return compare<2>(a, b) < 0;
0050 }
0051 }