13 #include <boost/test/data/test_case.hpp>
14 #include <boost/test/unit_test.hpp>
34 #include <type_traits>
43 constexpr
auto eps = 8 * std::numeric_limits<double>::epsilon();
51 Vector3 sentinel = Vector3::Random();
53 BOOST_CHECK_MESSAGE(pos != sentinel,
"Position was not changed");
55 std::isfinite(pos[0]),
56 "Position " << pos.transpose() <<
" contains non-finite entries");
58 std::isfinite(pos[1]),
59 "Position " << pos.transpose() <<
" contains non-finite entries");
61 std::isfinite(pos[2]),
62 "Position " << pos.transpose() <<
" contains non-finite entries");
65 "Position " << pos.transpose() <<
" is not on the surface");
69 BOOST_CHECK(lpResult.ok());
77 const auto posAngle = bdata::xrange(-M_PI, M_PI, 0.25);
78 const auto posPositiveNonzero = bdata::xrange(0.25, 1.0, 0.25);
79 const auto posPositive = bdata::make(0.0) + posPositiveNonzero;
80 const auto posSymmetric = bdata::xrange(-1.0, 1.0, 0.25);
82 const auto phis = bdata::xrange(-M_PI, M_PI, M_PI_4);
83 const auto thetasNoForwardBackward = bdata::xrange(M_PI_4, M_PI, M_PI_4);
84 const auto thetas = bdata::make({0.0, M_PI}) + thetasNoForwardBackward;
89 const auto cones = bdata::make({
90 Surface::makeShared<ConeSurface>(Transform3::Identity(),
93 const auto cylinders = bdata::make({
94 Surface::makeShared<CylinderSurface>(Transform3::Identity(),
97 const auto discs = bdata::make({
98 Surface::makeShared<DiscSurface>(Transform3::Identity(), 0 ,
101 const auto perigees = bdata::make({
102 Surface::makeShared<PerigeeSurface>(
Vector3(0, 0, -1.5)),
104 const auto planes = bdata::make({
105 Surface::makeShared<PlaneSurface>(
Vector3(1, 2, 3), Vector3::UnitX()),
106 Surface::makeShared<PlaneSurface>(
Vector3(-2, -3, -4), Vector3::UnitY()),
107 Surface::makeShared<PlaneSurface>(
Vector3(3, -4, 5), Vector3::UnitZ()),
109 const auto straws = bdata::make({
110 Surface::makeShared<StrawSurface>(Transform3::Identity(), 2.0 ,
116 BOOST_AUTO_TEST_SUITE(SurfaceLocalToGlobalRoundtrip)
119 cones* posAngle* posPositiveNonzero* phis*
thetas, surface,
120 lphi, lz, phi, theta) {
123 const auto r = lz * surface->bounds().tanAlpha();
125 runTest(*surface, (0 < lz) ? (
r * lphi) : 0.0, lz, phi, theta);
129 cylinders* posSymmetric* posSymmetric* phis*
thetas,
130 surface, lrphi, lz, phi, theta) {
131 runTest(*surface, lrphi, lz, phi, theta);
135 surface, lr, lphi, phi, theta) {
137 runTest(*surface, lr, (0 < lr) ? lphi : 0.0, phi, theta);
142 perigees* posSymmetric* posSymmetric* phis* thetasNoForwardBackward,
143 surface, d0, z0, phi, theta) {
145 runTest(*surface, d0, z0, phi, theta);
149 planes* posSymmetric* posSymmetric* phis*
thetas, surface,
150 l0, l1, phi, theta) {
151 runTest(*surface, l0, l1, phi, theta);
156 straws* posSymmetric* posSymmetric* phis* thetasNoForwardBackward, surface,
157 lr, lz, phi, theta) {
159 runTest(*surface, lr, lz, phi, theta);
162 BOOST_AUTO_TEST_SUITE_END()