Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:13:07

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 // Local include(s).
0010 #include "TestSpacePoint.hpp"
0011 
0012 // System include(s).
0013 #include <cmath>
0014 #include <iostream>
0015 #include <limits>
0016 
0017 /// Difference allowed on floating point numbers to still be treated equal
0018 static constexpr float allowedDiff = std::numeric_limits<float>::epsilon() * 4;
0019 
0020 bool operator==(const TestSpacePoint& a, const TestSpacePoint& b) {
0021   return ((std::abs(a.m_x - b.m_x) < allowedDiff) &&
0022           (std::abs(a.m_y - b.m_y) < allowedDiff) &&
0023           (std::abs(a.m_z - b.m_z) < allowedDiff));
0024 }
0025 
0026 std::ostream& operator<<(std::ostream& out, const TestSpacePoint& sp) {
0027   out << "[surface: " << sp.m_surface << ", x: " << sp.m_x << ", y: " << sp.m_y
0028       << ", z: " << sp.m_z << "]";
0029   return out;
0030 }