9 #include <boost/test/unit_test.hpp>
24 namespace tt = boost::test_tools;
29 Vector3 edgePosition(0.5, 0.5, 0.5);
35 BOOST_CHECK_EQUAL(xUtil_eq.
bins(), (size_t)10);
38 xyUtil_eq += yUtil_eq;
39 BOOST_CHECK_EQUAL(xyUtil_eq.
bins(), 100
u);
42 xyzUtil_eq += zUtil_eq;
43 BOOST_CHECK_EQUAL(xyzUtil_eq.bins(), 1000
u);
47 BOOST_CHECK_EQUAL(xyzUtil_eq.dimensions(), 3
u);
51 BOOST_CHECK_EQUAL(xUtil_eq_copy, xUtil_eq);
52 BOOST_CHECK_NE(yUtil_eq, xUtil_eq);
55 auto xTriple = xUtil_eq.
binTriple(xyzPosition);
56 auto xyTriple = xyUtil_eq.
binTriple(xyzPosition);
57 auto xyzTriple = xyzUtil_eq.binTriple(xyzPosition);
59 BOOST_CHECK_EQUAL(xTriple[0], 1
u);
60 BOOST_CHECK_EQUAL(xTriple[1], 0
u);
61 BOOST_CHECK_EQUAL(xTriple[2], 0
u);
63 BOOST_CHECK_EQUAL(xyTriple[0], 1
u);
64 BOOST_CHECK_EQUAL(xyTriple[1], 2
u);
65 BOOST_CHECK_EQUAL(xyTriple[2], 0
u);
67 BOOST_CHECK_EQUAL(xyzTriple[0], 1
u);
68 BOOST_CHECK_EQUAL(xyzTriple[1], 2
u);
69 BOOST_CHECK_EQUAL(xyzTriple[2], 3
u);
74 std::vector<float> bvalues = {-5., 0., 1., 1.1, 8.};
78 BOOST_CHECK_EQUAL(xUtil.
bin(
Vector3(-6., 0., 0.)), 0
u);
80 BOOST_CHECK_EQUAL(xUtil.
bin(
Vector3(-4., 0., 0.)), 0
u);
82 BOOST_CHECK_EQUAL(xUtil.
bin(
Vector3(0.5, 0., 0.)), 1
u);
84 BOOST_CHECK_EQUAL(xUtil.
bin(
Vector3(1.05, 0., 0.)), 2
u);
86 BOOST_CHECK_EQUAL(xUtil.
bin(
Vector3(4., 0., 0.)), 3
u);
88 BOOST_CHECK_EQUAL(xUtil.
bin(
Vector3(9., 0., 0.)), 3
u);
93 Transform3 transform_LtoG = Transform3::Identity();
94 transform_LtoG = transform_LtoG *
Translation3(0., 0., -50);
97 Transform3 transform_GtoL = transform_LtoG.inverse();
105 noTranform += phiUtil;
109 withTranform += rUtil;
110 withTranform += phiUtil;
111 withTranform += zUtil;
117 Vector3 pos5(80, -M_PI / 4, 50);
119 for (
int i = 0;
i < 3;
i++) {
120 BOOST_CHECK_EQUAL(withTranform.
bin(pos1,
i),
121 noTranform.
bin(transform_GtoL * pos1,
i));
122 BOOST_CHECK_EQUAL(withTranform.
bin(pos2,
i),
123 noTranform.
bin(transform_GtoL * pos2,
i));
124 BOOST_CHECK_EQUAL(withTranform.
bin(pos3,
i),
125 noTranform.
bin(transform_GtoL * pos3,
i));
126 BOOST_CHECK_EQUAL(withTranform.
bin(pos4,
i),
127 noTranform.
bin(transform_GtoL * pos4,
i));
128 BOOST_CHECK_EQUAL(withTranform.
bin(pos5,
i),
129 noTranform.
bin(transform_GtoL * pos5,
i));