13 #include <boost/test/data/test_case.hpp>
14 #include <boost/test/unit_test.hpp>
41 Vector3D sentinel = Vector3D::Random();
43 BOOST_CHECK_MESSAGE(pos != sentinel,
"Position was not changed");
45 std::isfinite(pos[0]),
46 "Position " << pos.transpose() <<
" contains non-finite entries");
48 std::isfinite(pos[1]),
49 "Position " << pos.transpose() <<
" contains non-finite entries");
51 std::isfinite(pos[2]),
52 "Position " << pos.transpose() <<
" contains non-finite entries");
55 "Position " << pos.transpose() <<
" is not on the surface");
59 BOOST_CHECK(lpResult.ok());
68 const auto posPositiveNonzero =
bdata::xrange(0.25, 1.0, 0.25);
69 const auto posPositive = bdata::make(0.0) + posPositiveNonzero;
74 const auto thetas = bdata::make({0.0,
M_PI}) + thetasNoForwardBackward;
79 const auto cones = bdata::make({
80 Surface::makeShared<ConeSurface>(Transform3D::Identity(),
83 const auto cylinders = bdata::make({
84 Surface::makeShared<CylinderSurface>(Transform3D::Identity(),
87 const auto discs = bdata::make({
88 Surface::makeShared<DiscSurface>(Transform3D::Identity(),
91 const auto perigees = bdata::make({
92 Surface::makeShared<PerigeeSurface>(
Vector3D(0, 0, -1.5)),
94 const auto planes = bdata::make({
95 Surface::makeShared<PlaneSurface>(
Vector3D(1, 2, 3), Vector3D::UnitX()),
96 Surface::makeShared<PlaneSurface>(
Vector3D(-2, -3, -4), Vector3D::UnitY()),
97 Surface::makeShared<PlaneSurface>(
Vector3D(3, -4, 5), Vector3D::UnitZ()),
99 const auto straws = bdata::make({
100 Surface::makeShared<StrawSurface>(Transform3D::Identity(), 2.0 ,
106 BOOST_AUTO_TEST_SUITE(SurfaceLocalToGlobalRoundtrip)
109 cones* posAngle* posPositiveNonzero* phis* thetas, surface,
110 lphi, lz, phi, theta) {
113 const auto r = lz * surface->bounds().tanAlpha();
115 runTest(*surface, (0 < lz) ? (r * lphi) : 0.0, lz, phi, theta);
119 cylinders* posSymmetric* posSymmetric* phis* thetas,
120 surface, lrphi, lz, phi, theta) {
121 runTest(*surface, lrphi, lz, phi, theta);
125 surface, lr, lphi, phi, theta) {
127 runTest(*surface, lr, (0 < lr) ? lphi : 0.0, phi, theta);
132 perigees* posSymmetric* posSymmetric* phis* thetasNoForwardBackward,
133 surface, d0, z0, phi, theta) {
135 runTest(*surface, d0, z0, phi, theta);
139 planes* posSymmetric* posSymmetric* phis* thetas, surface,
140 l0, l1, phi, theta) {
141 runTest(*surface, l0, l1, phi, theta);
146 straws* posSymmetric* posSymmetric* phis* thetasNoForwardBackward, surface,
147 lr, lz, phi, theta) {
149 runTest(*surface, lr, lz, phi, theta);
152 BOOST_AUTO_TEST_SUITE_END()