ATLAS Offline Software
Loading...
Searching...
No Matches
GeoPrimitivesCompare.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3*/
4
14
15#ifndef GEOPRIMITIVESCOMPARE_H_
16#define GEOPRIMITIVESCOMPARE_H_
17
18#include <vector>
20
21namespace Amg {
22
23
35{
36 bool operator()(Amg::Vector3D const &v1, Amg::Vector3D const &v2) const
37 {
38 if ( v1.z() > v2.z() ) {
39 return false;
40 } else if ( v1.z() < v2.z() ) {
41 return true;
42 } else if ( v1.y() > v2.y() ) {
43 return false;
44 } else if ( v1.y() < v2.y() ) {
45 return true;
46 } else if ( v1.x() > v2.x() ) {
47 return false;
48 } else if ( v1.x() < v2.x() ) {
49 return true;
50 } else {
51 return false;
52 }
53 }
54};
55
56
58{
59 bool operator()(std::vector<Amg::Vector3D> const &vv1, std::vector<Amg::Vector3D> const &vv2) const
60 {
61 std::vector<Amg::Vector3D>::const_iterator v1 = vv1.begin();
62 std::vector<Amg::Vector3D>::const_iterator v2 = vv2.begin();
63
64 while (v1 != vv1.end()) {
65 if (v2 == vv2.end()) return false;
66 if ( (*v1).z() > (*v2).z() ) {
67 return false;
68 } else if ( (*v1).z() < (*v2).z() ) {
69 return true;
70 } else if ( (*v1).y() > (*v2).y() ) {
71 return false;
72 } else if ( (*v1).y() < (*v2).y() ) {
73 return true;
74 } else if ( (*v1).x() > (*v2).x() ) {
75 return false;
76 } else if ( (*v1).x() < (*v2).x() ) {
77 return true;
78 }
79 ++v1;
80 ++v2;
81 }
82 if (v2 != vv2.end()) return true;
83 return false;
84}
85
86};
87
88
89} // end namespace
90
91#endif /* GEOPRIMITIVESCOMPARE_H_ */
Definition of ATLAS Math & Geometry primitives (Amg)
Eigen::Matrix< double, 3, 1 > Vector3D
comparison of two Vector3D, needed for the definition of a std::set<Amg::Vector3D>
bool operator()(Amg::Vector3D const &v1, Amg::Vector3D const &v2) const
bool operator()(std::vector< Amg::Vector3D > const &vv1, std::vector< Amg::Vector3D > const &vv2) const