19 using Eigen::Vector2d;
20 using Eigen::Vector3d;
27 Vector2d coords(0.5, 0.5);
30 BOOST_TEST(ret.sum() == 1.0);
31 BOOST_TEST(equals(ret, coords));
35 Vector2d coords(1.0, 0.0);
38 BOOST_TEST(ret.sum() == 1.0);
39 BOOST_TEST(equals(ret, coords));
43 Vector2d coords(0, 1.0);
46 BOOST_TEST(ret.sum() == 1.0);
47 BOOST_TEST(equals(ret, coords));
50 Vector2d l(0.75, 1.0);
51 Vector2d coords(0.25, 0.75);
53 BOOST_TEST(ret.sum() == 1.0);
54 BOOST_TEST(equals(ret, coords),
"Coords are " << ret <<
" but should be " << coords);
61 using Eigen::Vector2d;
62 using Eigen::Vector3d;
64 Vector3d a(0.0, 0.0, 0.0);
65 Vector3d b(1.0, 0.0, 0.0);
66 Vector3d n(0.0, 0.0, 1.0);
68 Vector3d l(0.5, 0.0, 0.0);
69 Vector2d coords(0.5, 0.5);
72 BOOST_TEST(ret.sum() == 1.0);
73 BOOST_TEST(equals(ret, coords));
76 Vector3d l(0.0, 0.0, 0.0);
77 Vector2d coords(1.0, 0.0);
80 BOOST_TEST(ret.sum() == 1.0);
81 BOOST_TEST(equals(ret, coords));
84 Vector3d l(1.0, 0.0, 0.0);
85 Vector2d coords(0, 1.0);
88 BOOST_TEST(ret.sum() == 1.0);
89 BOOST_TEST(equals(ret, coords));
92 Vector3d l(0.75, 1.0, 0.0);
93 Vector2d coords(0.25, 0.75);
95 BOOST_TEST(ret.sum() == 1.0);
96 BOOST_TEST(equals(ret, coords), fmt::format(
"Coords are {} but should be {}", ret, coords));
107 using Eigen::Vector3d;
109 Vector3d a(0.0, 0.0, 0.0);
110 Vector3d b(0.0, 1.0, 0.0);
111 Vector3d c(1.0, 0.0, 0.0);
112 Vector3d n(0.0, 0.0, 1.0);
115 Vector3d coords(1.0, 0.0, 0.0);
117 BOOST_TEST(ret.sum() == 1.0);
118 BOOST_TEST(equals(ret, coords));
122 Vector3d coords(0.0, 1.0, 0.0);
124 BOOST_TEST(ret.sum() == 1.0);
125 BOOST_TEST(equals(ret, coords));
129 Vector3d coords(0.0, 0.0, 1.0);
131 BOOST_TEST(ret.sum() == 1.0);
132 BOOST_TEST(equals(ret, coords));
136 Vector3d l = (a + b + c) / 3;
137 Vector3d coords(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0);
139 BOOST_TEST(ret.sum() == 1.0);
140 BOOST_TEST(equals(ret, coords));
144 Vector3d l = (a + b) / 2;
145 Vector3d coords(0.5, 0.5, 0.0);
147 BOOST_TEST(ret.sum() == 1.0);
148 BOOST_TEST(equals(ret, coords));
152 Vector3d l = (b + c) / 2;
153 Vector3d coords(0.0, 0.5, 0.5);
155 BOOST_TEST(ret.sum() == 1.0);
156 BOOST_TEST(equals(ret, coords));
160 Vector3d l = (a + c) / 2;
161 Vector3d coords(0.5, 0.0, 0.5);
163 BOOST_TEST(ret.sum() == 1.0);
164 BOOST_TEST(equals(ret, coords));
168 Vector3d l(2.0, 0.0, 0.0);
177 using Eigen::Vector2d;
178 using Eigen::Vector3d;
180 Vector2d a(0.0, 0.0);
181 Vector2d b(0.0, 1.0);
182 Vector2d c(1.0, 0.0);
183 Vector2d n(0.0, 0.0);
186 Vector3d coords(1.0, 0.0, 0.0);
188 BOOST_TEST(ret.sum() == 1.0);
189 BOOST_TEST(equals(ret, coords));
193 Vector3d coords(0.0, 1.0, 0.0);
195 BOOST_TEST(ret.sum() == 1.0);
196 BOOST_TEST(equals(ret, coords));
200 Vector3d coords(0.0, 0.0, 1.0);
202 BOOST_TEST(ret.sum() == 1.0);
203 BOOST_TEST(equals(ret, coords));
207 Vector2d l = (a + b + c) / 3;
208 Vector3d coords(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0);
210 BOOST_TEST(ret.sum() == 1.0);
211 BOOST_TEST(equals(ret, coords));
215 Vector2d l = (a + b) / 2;
216 Vector3d coords(0.5, 0.5, 0.0);
218 BOOST_TEST(ret.sum() == 1.0);
219 BOOST_TEST(equals(ret, coords));
223 Vector2d l = (b + c) / 2;
224 Vector3d coords(0.0, 0.5, 0.5);
226 BOOST_TEST(ret.sum() == 1.0);
227 BOOST_TEST(equals(ret, coords));
231 Vector2d l = (a + c) / 2;
232 Vector3d coords(0.5, 0.0, 0.5);
234 BOOST_TEST(ret.sum() == 1.0);
235 BOOST_TEST(equals(ret, coords));
239 Vector2d l(2.0, 0.0);
250 Eigen::Vector3d a{0.0, 0.0, 0.0};
251 Eigen::Vector3d b{0.0, 1.0, 0.0};
252 Eigen::Vector3d c{1.0, 0.0, 0.0};
253 Eigen::Vector3d d{0.0, 0.0, 1.0};
255 Eigen::Vector3d center{0.25, 0.25, 0.25};
356 using Eigen::Vector4d;
358 Eigen::Vector4d coords(1. / 3, 1. / 3, 0.0, 1. / 3);
360 BOOST_TEST(ret.sum() == 1.0);
388 Eigen::Vector4d coords(1.0, 1.0, 1.0, -2.0);
390 BOOST_TEST(ret.sum() == 1.0);
boost::test_tools::predicate_result equals(const std::vector< float > &VectorA, const std::vector< float > &VectorB, float tolerance)
equals to be used in tests. Compares two std::vectors using a given tolerance. Prints both operands o...