39 #include <visp3/core/vpConfig.h>
41 #if defined(VISP_HAVE_CATCH2)
45 #include <visp3/core/vpPoseVector.h>
47 #include <catch_amalgamated.hpp>
49 #ifdef ENABLE_VISP_NAMESPACE
55 void checkSize(
const vpPoseVector &pose,
const std::vector<double> &ref)
57 REQUIRE(pose.
size() == 6);
60 REQUIRE(pose.
size() == ref.size());
63 void checkData(
const vpPoseVector &pose,
const std::vector<double> &ref)
65 for (
unsigned int i = 0; i < pose.
size(); i++) {
66 REQUIRE(pose[i] == Catch::Approx(ref[i]).epsilon(std::numeric_limits<double>::epsilon()));
71 TEST_CASE(
"vpPoseVector size",
"[vpColVector]")
74 REQUIRE(pose.
size() == 6);
78 for (
unsigned int i = 0; i < pose.
getRows(); i++) {
79 REQUIRE(pose[i] == Catch::Approx(0).epsilon(std::numeric_limits<double>::epsilon()));
83 TEST_CASE(
"vpPoseVector value assignment",
"[vpColVector]")
86 std::vector<double> ref(6);
87 pose[0] = ref[0] = 0.1;
88 pose[1] = ref[1] = 0.2;
89 pose[2] = ref[2] = 0.3;
98 TEST_CASE(
"vpPoseVector constructor",
"[vpColVector]")
100 std::vector<double> ref(6);
108 vpPoseVector pose(ref[0], ref[1], ref[2], ref[3], ref[4], ref[5]);
110 checkSize(pose, ref);
111 checkData(pose, ref);
114 TEST_CASE(
"vpPoseVector copy constructor",
"[vpColVector]")
118 vpPoseVector pose1(ref[0], ref[1], ref[2], ref[3], ref[4], ref[5]);
121 checkSize(pose2, ref);
122 checkData(pose2, ref);
125 TEST_CASE(
"vpPoseVector object assignment",
"[vpColVector]")
129 vpPoseVector pose1(ref[0], ref[1], ref[2], ref[3], ref[4], ref[5]);
132 checkSize(pose2, ref);
133 checkData(pose2, ref);
136 TEST_CASE(
"vpPoseVector set",
"[vpColVector]")
140 vpPoseVector pose1(ref[0], ref[1], ref[2], ref[3], ref[4], ref[5]);
142 pose2.
set(pose1[0], pose1[1], pose1[2], pose1[3], pose1[4], pose1[5]);
144 checkSize(pose2, ref);
145 checkData(pose2, ref);
148 TEST_CASE(
"vpPoseVector constructor t, tu",
"[vpColVector]")
156 checkSize(pose, ref);
157 checkData(pose, ref);
160 TEST_CASE(
"vpPoseVector build t, tu",
"[vpColVector]")
169 checkSize(pose, ref);
170 checkData(pose, ref);
173 TEST_CASE(
"vpPoseVector constructor vpHomogeneousMatrix",
"[vpColVector]")
182 checkSize(pose, ref);
183 checkData(pose, ref);
186 TEST_CASE(
"vpPoseVector build vpHomogeneousMatrix",
"[vpColVector]")
196 checkSize(pose, ref);
197 checkData(pose, ref);
200 TEST_CASE(
"vpPoseVector constructor t, R",
"[vpColVector]")
209 checkSize(pose, ref);
210 checkData(pose, ref);
213 TEST_CASE(
"vpPoseVector build t, R",
"[vpColVector]")
223 checkSize(pose, ref);
224 checkData(pose, ref);
227 int main(
int argc,
char *argv[])
229 Catch::Session session;
230 session.applyCommandLine(argc, argv);
231 int numFailed = session.run();
237 int main() {
return EXIT_SUCCESS; }
unsigned int getCols() const
unsigned int size() const
Return the number of elements of the 2D array.
unsigned int getRows() const
Implementation of an homogeneous matrix and operations on such kind of matrices.
static double rad(double deg)
Implementation of a pose vector and operations on poses.
void set(double tx, double ty, double tz, double tux, double tuy, double tuz)
vpPoseVector & buildFrom(const double &tx, const double &ty, const double &tz, const double &tux, const double &tuy, const double &tuz)
Implementation of a rotation matrix and operations on such kind of matrices.
Implementation of a rotation vector as axis-angle minimal representation.
Class that consider the case of a translation vector.