154 {
155 LOG_UNIT_TEST;
156
157
158 const Real eps = std::numeric_limits<Real>::epsilon();
159
160
161
162
163
164 std::vector<Real>
165 mins = {1, 0, 0},
166 maxs = {2, 1, 1};
167
168
170
171
172 typedef std::tuple<Real, bool, bool> TestTuple;
173 std::vector<TestTuple> tests =
174 {
175 std::make_tuple(1., true, true),
176 std::make_tuple(1. + eps, false, true),
177 std::make_tuple(1. - eps, true, true),
178 std::make_tuple(1.5, false, false),
179 std::make_tuple(0.5, true, true)
180 };
181
182 for (unsigned int dir = 0; dir < 3; ++dir)
183 {
184
185
186
187
188
189
191 min(
Point(mins[0], mins[1], mins[2])),
192 max(
Point(maxs[0], maxs[1], maxs[2]));
193
194
195
196 for (const auto & t : tests)
197 {
198
199 Point cmin = min, cmax = max;
200 cmin(dir) = std::get<0>(t);
202
203
204
205
206 CPPUNIT_ASSERT(initial.intersects(comparison) == std::get<1>(t));
207 CPPUNIT_ASSERT(comparison.intersects(initial) == std::get<1>(t));
208
209
210 CPPUNIT_ASSERT(initial.intersects(comparison,
TOLERANCE) == std::get<2>(t));
211 CPPUNIT_ASSERT(comparison.intersects(initial,
TOLERANCE) == std::get<2>(t));
212 }
213
214
215
216
217 std::rotate(mins.rbegin(), mins.rbegin()+1, mins.rend());
218 std::rotate(maxs.rbegin(), maxs.rbegin()+1, maxs.rend());
219 }
220 }
Defines a Cartesian bounding box by the two corner extremum.
A Point defines a location in LIBMESH_DIM dimensional Real space.
static constexpr Real TOLERANCE
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real