39 #include <visp3/core/vpConfig.h>
41 #ifdef VISP_HAVE_CATCH2
45 #include <visp3/core/vpPoseVector.h>
47 #define CATCH_CONFIG_RUNNER
50 #ifdef ENABLE_VISP_NAMESPACE
56 void checkSize(
const vpPoseVector &pose,
const std::vector<double> &ref)
58 REQUIRE(pose.
size() == 6);
61 REQUIRE(pose.
size() == ref.size());
64 void checkData(
const vpPoseVector &pose,
const std::vector<double> &ref)
66 for (
unsigned int i = 0; i < pose.
size(); i++) {
67 REQUIRE(pose[i] == Approx(ref[i]).epsilon(std::numeric_limits<double>::epsilon()));
72 TEST_CASE(
"vpPoseVector size",
"[vpColVector]")
75 REQUIRE(pose.
size() == 6);
79 for (
unsigned int i = 0; i < pose.
getRows(); i++) {
80 REQUIRE(pose[i] == Approx(0).epsilon(std::numeric_limits<double>::epsilon()));
84 TEST_CASE(
"vpPoseVector value assignment",
"[vpColVector]")
87 std::vector<double> ref(6);
88 pose[0] = ref[0] = 0.1;
89 pose[1] = ref[1] = 0.2;
90 pose[2] = ref[2] = 0.3;
99 TEST_CASE(
"vpPoseVector constructor",
"[vpColVector]")
101 std::vector<double> ref(6);
109 vpPoseVector pose(ref[0], ref[1], ref[2], ref[3], ref[4], ref[5]);
111 checkSize(pose, ref);
112 checkData(pose, ref);
115 TEST_CASE(
"vpPoseVector copy constructor",
"[vpColVector]")
119 vpPoseVector pose1(ref[0], ref[1], ref[2], ref[3], ref[4], ref[5]);
122 checkSize(pose2, ref);
123 checkData(pose2, ref);
126 TEST_CASE(
"vpPoseVector object assignment",
"[vpColVector]")
130 vpPoseVector pose1(ref[0], ref[1], ref[2], ref[3], ref[4], ref[5]);
133 checkSize(pose2, ref);
134 checkData(pose2, ref);
137 TEST_CASE(
"vpPoseVector set",
"[vpColVector]")
141 vpPoseVector pose1(ref[0], ref[1], ref[2], ref[3], ref[4], ref[5]);
143 pose2.
set(pose1[0], pose1[1], pose1[2], pose1[3], pose1[4], pose1[5]);
145 checkSize(pose2, ref);
146 checkData(pose2, ref);
149 TEST_CASE(
"vpPoseVector constructor t, tu",
"[vpColVector]")
157 checkSize(pose, ref);
158 checkData(pose, ref);
161 TEST_CASE(
"vpPoseVector build t, tu",
"[vpColVector]")
170 checkSize(pose, ref);
171 checkData(pose, ref);
174 TEST_CASE(
"vpPoseVector constructor vpHomogeneousMatrix",
"[vpColVector]")
183 checkSize(pose, ref);
184 checkData(pose, ref);
187 TEST_CASE(
"vpPoseVector build vpHomogeneousMatrix",
"[vpColVector]")
197 checkSize(pose, ref);
198 checkData(pose, ref);
201 TEST_CASE(
"vpPoseVector constructor t, R",
"[vpColVector]")
210 checkSize(pose, ref);
211 checkData(pose, ref);
214 TEST_CASE(
"vpPoseVector build t, R",
"[vpColVector]")
224 checkSize(pose, ref);
225 checkData(pose, ref);
228 int main(
int argc,
char *argv[])
230 Catch::Session session;
233 session.applyCommandLine(argc, argv);
235 int numFailed = session.run();
245 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.
vpPoseVector & build(const double &tx, const double &ty, const double &tz, const double &tux, const double &tuy, const double &tuz)
void set(double tx, double ty, double tz, double tux, double tuy, 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.