9 #include <boost/test/unit_test.hpp>
26 BOOST_CHECK(
bool(fIp));
27 BOOST_CHECK(
bool(sIp));
28 BOOST_CHECK(
bool(tIp));
32 BOOST_CHECK(!
bool(nIp));
34 std::vector<Intersection> fstpIntersections = {fIp, sIp, tIp};
35 std::vector<Intersection> tsfpIntersections = {tIp, sIp, fIp};
38 std::sort(tsfpIntersections.begin(), tsfpIntersections.end());
39 BOOST_CHECK_EQUAL(fstpIntersections[0].pathLength,
40 tsfpIntersections[0].pathLength);
41 BOOST_CHECK_EQUAL(fstpIntersections[1].pathLength,
42 tsfpIntersections[1].pathLength);
43 BOOST_CHECK_EQUAL(fstpIntersections[2].pathLength,
44 tsfpIntersections[2].pathLength);
47 std::sort(tsfpIntersections.begin(), tsfpIntersections.end(),
49 BOOST_CHECK_EQUAL(fstpIntersections[0].pathLength,
50 tsfpIntersections[2].pathLength);
51 BOOST_CHECK_EQUAL(fstpIntersections[1].pathLength,
52 tsfpIntersections[1].pathLength);
53 BOOST_CHECK_EQUAL(fstpIntersections[2].pathLength,
54 tsfpIntersections[0].pathLength);
58 std::vector<Intersection> ntfspIntersections = {nIp, tIp, fIp, sIp};
59 std::vector<Intersection> tfnsnpIntersections = {tIp, fIp, nIp, sIp, nIp};
62 std::sort(ntfspIntersections.begin(), ntfspIntersections.end());
63 BOOST_CHECK_EQUAL(fstpIntersections[0].pathLength,
64 ntfspIntersections[0].pathLength);
65 BOOST_CHECK_EQUAL(fstpIntersections[1].pathLength,
66 ntfspIntersections[1].pathLength);
67 BOOST_CHECK_EQUAL(fstpIntersections[2].pathLength,
68 ntfspIntersections[2].pathLength);
69 BOOST_CHECK_EQUAL(
bool(ntfspIntersections[3]),
false);
71 std::sort(tfnsnpIntersections.begin(), tfnsnpIntersections.end());
72 BOOST_CHECK_EQUAL(fstpIntersections[0].pathLength,
73 tfnsnpIntersections[0].pathLength);
74 BOOST_CHECK_EQUAL(fstpIntersections[1].pathLength,
75 tfnsnpIntersections[1].pathLength);
76 BOOST_CHECK_EQUAL(fstpIntersections[2].pathLength,
77 tfnsnpIntersections[2].pathLength);
78 BOOST_CHECK_EQUAL(
bool(tfnsnpIntersections[3]),
false);
79 BOOST_CHECK_EQUAL(
bool(tfnsnpIntersections[4]),
false);
86 std::vector<Intersection> tsfnIntersections = {tIn, sIn, fIn};
87 std::vector<Intersection> fstnIntersections = {fIn, sIn, tIn};
90 std::sort(fstnIntersections.begin(), fstnIntersections.end());
91 BOOST_CHECK_EQUAL(fstnIntersections[0].pathLength,
92 tsfnIntersections[0].pathLength);
93 BOOST_CHECK_EQUAL(fstnIntersections[1].pathLength,
94 tsfnIntersections[1].pathLength);
95 BOOST_CHECK_EQUAL(fstnIntersections[2].pathLength,
96 tsfnIntersections[2].pathLength);
99 std::sort(fstnIntersections.begin(), fstnIntersections.end(),
101 BOOST_CHECK_EQUAL(fstnIntersections[0].pathLength,
102 tsfnIntersections[2].pathLength);
103 BOOST_CHECK_EQUAL(fstnIntersections[1].pathLength,
104 tsfnIntersections[1].pathLength);
105 BOOST_CHECK_EQUAL(fstnIntersections[2].pathLength,
106 tsfnIntersections[0].pathLength);
109 std::vector<Intersection> pnsolutions = {tIp, sIn, sIp, fIn, tIn, fIp};
110 std::sort(pnsolutions.begin(), pnsolutions.end());
112 BOOST_CHECK_EQUAL(pnsolutions[0].pathLength, -3.);
113 BOOST_CHECK_EQUAL(pnsolutions[1].pathLength, -2.);
114 BOOST_CHECK_EQUAL(pnsolutions[2].pathLength, -1.);
115 BOOST_CHECK_EQUAL(pnsolutions[3].pathLength, 1.);
116 BOOST_CHECK_EQUAL(pnsolutions[4].pathLength, 2.);
117 BOOST_CHECK_EQUAL(pnsolutions[5].pathLength, 3.);
121 std::vector<Intersection> tszfpIntersections = {tIp, sIp, zI, fIp};
123 std::sort(tszfpIntersections.begin(), tszfpIntersections.end());
124 BOOST_CHECK_EQUAL(tszfpIntersections[0].pathLength, 0.);
125 BOOST_CHECK_EQUAL(tszfpIntersections[1].pathLength, 1.);
126 BOOST_CHECK_EQUAL(tszfpIntersections[2].pathLength, 2.);
127 BOOST_CHECK_EQUAL(tszfpIntersections[3].pathLength, 3.);
129 std::vector<Intersection> tfsznIntersections = {tIn, fIn, sIn, zI};
130 std::vector<Intersection> ztfsnIntersections = {zI, tIn, fIn, sIn};
132 std::sort(tfsznIntersections.begin(), tfsznIntersections.end(),
134 BOOST_CHECK_EQUAL(tfsznIntersections[0].pathLength, 0.);
135 BOOST_CHECK_EQUAL(tfsznIntersections[1].pathLength, -1.);
136 BOOST_CHECK_EQUAL(tfsznIntersections[2].pathLength, -2.);
137 BOOST_CHECK_EQUAL(tfsznIntersections[3].pathLength, -3.);
139 std::sort(ztfsnIntersections.begin(), ztfsnIntersections.end(),
141 BOOST_CHECK_EQUAL(ztfsnIntersections[0].pathLength, 0.);
142 BOOST_CHECK_EQUAL(ztfsnIntersections[1].pathLength, -1.);
143 BOOST_CHECK_EQUAL(ztfsnIntersections[2].pathLength, -2.);
144 BOOST_CHECK_EQUAL(ztfsnIntersections[3].pathLength, -3.);
149 auto psf6 = Surface::makeShared<PlaneSurface>(
Vector3D(6., 0., 0.),
151 auto psf7 = Surface::makeShared<PlaneSurface>(
Vector3D(7., 0., 0.),
153 auto psf8 = Surface::makeShared<PlaneSurface>(
Vector3D(8., 0., 0.),
155 auto psf9 = Surface::makeShared<PlaneSurface>(
Vector3D(9., 0., 0.),
157 auto psf10 = Surface::makeShared<PlaneSurface>(
Vector3D(10., 0., 0.),
162 PlaneIntersection int6(
165 PlaneIntersection int7(
168 PlaneIntersection int8(
171 PlaneIntersection int9a(
174 PlaneIntersection int9b(
176 Intersection::Status::reachable),
178 PlaneIntersection int10(
182 std::vector<PlaneIntersection> firstSet = {int6, int7, int9b, int10};
183 std::vector<PlaneIntersection> secondSet = {int8, int9a, int9b, int10};
185 std::vector<PlaneIntersection> unionSetStd = {};
187 std::vector<PlaneIntersection> unionSetCst = {};
190 std::set_union(firstSet.begin(), firstSet.end(), secondSet.begin(),
191 secondSet.end(), std::back_inserter(unionSetStd));
192 BOOST_CHECK_EQUAL(unionSetStd.size(), 6
u);
196 std::set_union(firstSet.begin(), firstSet.end(), secondSet.begin(),
197 secondSet.end(), std::back_inserter(unionSetCst),
199 BOOST_CHECK_EQUAL(unionSetCst.size(), 5
u);