#include <visp3/core/vpConfig.h>
#ifdef VISP_HAVE_CATCH2
#include <limits>
#include <vector>
#include <visp3/core/vpPoseVector.h>
#define CATCH_CONFIG_RUNNER
#include <catch.hpp>
namespace
{
void checkSize(
const vpPoseVector &pose,
const std::vector<double> &ref)
{
REQUIRE(pose.
size() == 6);
REQUIRE(pose.
size() == ref.size());
}
void checkData(
const vpPoseVector &pose,
const std::vector<double> &ref)
{
for (
unsigned int i = 0; i < pose.
size(); i++) {
REQUIRE(pose[i] == Approx(ref[i]).epsilon(std::numeric_limits<double>::epsilon()));
}
}
}
TEST_CASE("vpPoseVector size", "[vpColVector]")
{
REQUIRE(pose.
size() == 6);
for (
unsigned int i = 0; i < pose.
getRows(); i++) {
REQUIRE(pose[i] == Approx(0).epsilon(std::numeric_limits<double>::epsilon()));
}
}
TEST_CASE("vpPoseVector value assignment", "[vpColVector]")
{
std::vector<double> ref(6);
pose[0] = ref[0] = 0.1;
pose[1] = ref[1] = 0.2;
pose[2] = ref[2] = 0.3;
checkSize(pose, ref);
checkData(pose, ref);
}
TEST_CASE("vpPoseVector constructor", "[vpColVector]")
{
std::vector<double> ref(6);
ref[0] = 0.1;
ref[1] = 0.2;
ref[2] = 0.3;
vpPoseVector pose(ref[0], ref[1], ref[2], ref[3], ref[4], ref[5]);
checkSize(pose, ref);
checkData(pose, ref);
}
TEST_CASE("vpPoseVector copy constructor", "[vpColVector]")
{
vpPoseVector pose1(ref[0], ref[1], ref[2], ref[3], ref[4], ref[5]);
checkSize(pose2, ref);
checkData(pose2, ref);
}
TEST_CASE("vpPoseVector object assignment", "[vpColVector]")
{
vpPoseVector pose1(ref[0], ref[1], ref[2], ref[3], ref[4], ref[5]);
checkSize(pose2, ref);
checkData(pose2, ref);
}
TEST_CASE("vpPoseVector set", "[vpColVector]")
{
vpPoseVector pose1(ref[0], ref[1], ref[2], ref[3], ref[4], ref[5]);
pose2.
set(pose1[0], pose1[1], pose1[2], pose1[3], pose1[4], pose1[5]);
checkSize(pose2, ref);
checkData(pose2, ref);
}
TEST_CASE("vpPoseVector constructor t, tu", "[vpColVector]")
{
checkSize(pose, ref);
checkData(pose, ref);
}
TEST_CASE("vpPoseVector buildFrom t, tu", "[vpColVector]")
{
checkSize(pose, ref);
checkData(pose, ref);
}
TEST_CASE("vpPoseVector constructor vpHomogeneousMatrix", "[vpColVector]")
{
checkSize(pose, ref);
checkData(pose, ref);
}
TEST_CASE("vpPoseVector buildFrom vpHomogeneousMatrix", "[vpColVector]")
{
checkSize(pose, ref);
checkData(pose, ref);
}
TEST_CASE("vpPoseVector constructor t, R", "[vpColVector]")
{
checkSize(pose, ref);
checkData(pose, ref);
}
TEST_CASE("vpPoseVector buildFrom t, R", "[vpColVector]")
{
checkSize(pose, ref);
checkData(pose, ref);
}
int main(int argc, char *argv[])
{
Catch::Session session;
session.applyCommandLine(argc, argv);
int numFailed = session.run();
return numFailed;
}
#else
#include <iostream>
int main() { return EXIT_SUCCESS; }
#endif
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(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.