1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
#include "DataFormats/GeometrySurface/interface/RectangularPlaneBounds.h"
#include "DataFormats/GeometrySurface/interface/LocalError.h"
#include "FWCore/Utilities/interface/HRRealTime.h"
#include <iostream>
void st() {}
void en() {}
int main() {
RectangularPlaneBounds bound(1., 1., 1.);
Local3DPoint a(10., 10., 10.);
Local3DPoint in(0., 0., 0.);
Local3DPoint in2(0.5, 0., 0.);
Local3DPoint outY(0., 3., 0.);
Local3DPoint out2(0., 1.5, 0.);
Local3DPoint outZ(0., 3., 3.);
LocalError err(0.1, 0.0, 0.1);
LocalError errB(1.0, 0.0, 1.0);
bool ok;
// usual first to load whatever
{
edm::HRTimeType s = edm::hrRealTime();
ok = bound.inside(a);
edm::HRTimeType e = edm::hrRealTime();
std::cout << e - s << std::endl;
if (ok)
std::cout << "inside?" << std::endl;
}
{
edm::HRTimeType s = edm::hrRealTime();
st();
ok = bound.inside(outZ);
en();
edm::HRTimeType e = edm::hrRealTime();
std::cout << e - s << std::endl;
if (ok)
std::cout << "inside?" << std::endl;
}
{
edm::HRTimeType s = edm::hrRealTime();
st();
ok = bound.inside(in);
en();
edm::HRTimeType e = edm::hrRealTime();
std::cout << e - s << std::endl;
if (!ok)
std::cout << "not inside?" << std::endl;
}
{
edm::HRTimeType s = edm::hrRealTime();
st();
ok = bound.inside(in, err);
en();
edm::HRTimeType e = edm::hrRealTime();
std::cout << e - s << std::endl;
if (!ok)
std::cout << "not inside?" << std::endl;
}
{
edm::HRTimeType s = edm::hrRealTime();
st();
auto io = bound.inout(in, err);
en();
edm::HRTimeType e = edm::hrRealTime();
std::cout << e - s << std::endl;
if (!io.first)
std::cout << "in not inside?" << std::endl;
if (io.second)
std::cout << "in outside?" << std::endl;
}
{
edm::HRTimeType s = edm::hrRealTime();
st();
auto io = bound.inout(in2, errB);
en();
edm::HRTimeType e = edm::hrRealTime();
std::cout << e - s << std::endl;
if (!io.first)
std::cout << "in2 not inside?" << std::endl;
if (!io.second)
std::cout << "in2 not outside?" << std::endl;
}
{
edm::HRTimeType s = edm::hrRealTime();
st();
ok = bound.inside(outY, err);
en();
edm::HRTimeType e = edm::hrRealTime();
std::cout << e - s << std::endl;
if (ok)
std::cout << "inside?" << std::endl;
}
{
edm::HRTimeType s = edm::hrRealTime();
st();
auto io = bound.inout(outY, err);
en();
edm::HRTimeType e = edm::hrRealTime();
std::cout << e - s << std::endl;
if (io.first)
std::cout << "outY inside?" << std::endl;
if (!io.second)
std::cout << "outY not outside?" << std::endl;
}
{
edm::HRTimeType s = edm::hrRealTime();
st();
auto io = bound.inout(out2, errB);
en();
edm::HRTimeType e = edm::hrRealTime();
std::cout << e - s << std::endl;
if (!io.first)
std::cout << "out2 not inside?" << std::endl;
if (!io.second)
std::cout << "out2 not outside?" << std::endl;
}
{
edm::HRTimeType s = edm::hrRealTime();
st();
ok = bound.inside(Local2DPoint(in.x(), in.y()), 1.f);
en();
edm::HRTimeType e = edm::hrRealTime();
std::cout << e - s << std::endl;
if (!ok)
std::cout << "not inside?" << std::endl;
}
{
edm::HRTimeType s = edm::hrRealTime();
st();
ok = bound.inside(Local2DPoint(outY.x(), outY.y()), 1.f);
en();
edm::HRTimeType e = edm::hrRealTime();
std::cout << e - s << std::endl;
if (ok)
std::cout << "inside?" << std::endl;
}
{
edm::HRTimeType s = edm::hrRealTime();
st();
ok = bound.inside(Local2DPoint(outY.x(), outY.y()), 10.f);
en();
edm::HRTimeType e = edm::hrRealTime();
std::cout << e - s << std::endl;
if (!ok)
std::cout << "not inside?" << std::endl;
}
return 0;
}
|