44 #include <visp3/core/vpConfig.h> 46 #ifdef VISP_HAVE_CATCH2 50 #include <visp3/core/vpPoseVector.h> 52 #define CATCH_CONFIG_RUNNER 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]") {
74 REQUIRE(pose.
size() == 6);
78 for (
unsigned int i = 0; i < pose.
getRows(); i++) {
79 REQUIRE(pose[i] == Approx(0).epsilon(std::numeric_limits<double>::epsilon()));
83 TEST_CASE(
"vpPoseVector value assignment",
"[vpColVector]") {
85 std::vector<double> ref(6);
86 pose[0] = ref[0] = 0.1;
87 pose[1] = ref[1] = 0.2;
88 pose[2] = ref[2] = 0.3;
97 TEST_CASE(
"vpPoseVector constructor",
"[vpColVector]") {
98 std::vector<double> ref(6);
106 vpPoseVector pose(ref[0], ref[1], ref[2], ref[3], ref[4], ref[5]);
108 checkSize(pose, ref);
109 checkData(pose, ref);
112 TEST_CASE(
"vpPoseVector copy constructor",
"[vpColVector]") {
113 std::vector<double> ref = { 0.1, 0.2, 0.3,
116 vpPoseVector pose1(ref[0], ref[1], ref[2], ref[3], ref[4], ref[5]);
119 checkSize(pose2, ref);
120 checkData(pose2, ref);
123 TEST_CASE(
"vpPoseVector object assignment",
"[vpColVector]") {
124 std::vector<double> ref = { 0.1, 0.2, 0.3,
127 vpPoseVector pose1(ref[0], ref[1], ref[2], ref[3], ref[4], ref[5]);
130 checkSize(pose2, ref);
131 checkData(pose2, ref);
134 TEST_CASE(
"vpPoseVector set",
"[vpColVector]") {
135 std::vector<double> ref = { 0.1, 0.2, 0.3,
138 vpPoseVector pose1(ref[0], ref[1], ref[2], ref[3], ref[4], ref[5]);
140 pose2.
set(pose1[0], pose1[1], pose1[2], pose1[3], pose1[4], pose1[5]);
142 checkSize(pose2, ref);
143 checkData(pose2, ref);
146 TEST_CASE(
"vpPoseVector constructor t, tu",
"[vpColVector]") {
147 std::vector<double> ref = { 0.1, 0.2, 0.3,
154 checkSize(pose, ref);
155 checkData(pose, ref);
158 TEST_CASE(
"vpPoseVector buildFrom t, tu",
"[vpColVector]") {
159 std::vector<double> ref = { 0.1, 0.2, 0.3,
167 checkSize(pose, ref);
168 checkData(pose, ref);
171 TEST_CASE(
"vpPoseVector constructor vpHomogeneousMatrix",
"[vpColVector]") {
172 std::vector<double> ref = { 0.1, 0.2, 0.3,
180 checkSize(pose, ref);
181 checkData(pose, ref);
184 TEST_CASE(
"vpPoseVector buildFrom vpHomogeneousMatrix",
"[vpColVector]") {
185 std::vector<double> ref = { 0.1, 0.2, 0.3,
194 checkSize(pose, ref);
195 checkData(pose, ref);
198 TEST_CASE(
"vpPoseVector constructor t, R",
"[vpColVector]") {
199 std::vector<double> ref = { 0.1, 0.2, 0.3,
207 checkSize(pose, ref);
208 checkData(pose, ref);
211 TEST_CASE(
"vpPoseVector buildFrom t, R",
"[vpColVector]") {
212 std::vector<double> ref = { 0.1, 0.2, 0.3,
221 checkSize(pose, ref);
222 checkData(pose, ref);
225 int main(
int argc,
char *argv[])
227 Catch::Session session;
230 session.applyCommandLine(argc, argv);
232 int numFailed = session.run();
Implementation of an homogeneous matrix and operations on such kind of matrices.
void set(double tx, double ty, double tz, double tux, double tuy, double tuz)
unsigned int getRows() const
unsigned int size() const
Return the number of elements of the 2D array.
Implementation of a rotation matrix and operations on such kind of matrices.
unsigned int getCols() const
vpPoseVector buildFrom(double tx, double ty, double tz, double tux, double tuy, double tuz)
static double rad(double deg)
Implementation of a pose vector and operations on poses.
Class that consider the case of a translation vector.
Implementation of a rotation vector as axis-angle minimal representation.