43#include <visp3/core/vpTranslationVector.h>
45#ifdef ENABLE_VISP_NAMESPACE
49bool test(
const std::string &s,
const vpArray2D<double> &A,
const std::vector<double> &bench);
51bool test(
const std::string &s,
const vpArray2D<double> &A,
const std::vector<double> &bench)
53 static unsigned int cpt = 0;
54 std::cout <<
"** Test " << ++cpt << std::endl;
55 std::cout <<
s <<
"(" << A.
getRows() <<
"," << A.
getCols() <<
") =" << A << std::endl;
56 if (bench.size() != A.
size()) {
57 std::cout <<
"Test fails: bad size wrt bench" << std::endl;
60 for (
unsigned int i = 0;
i < A.
size();
i++) {
61 if (std::fabs(A.
data[i] - bench[i]) > std::fabs(A.
data[i]) * std::numeric_limits<double>::epsilon()) {
62 std::cout <<
"Test fails: bad content" << std::endl;
75 std::vector<double> bench(3, 0);
76 if (test(
"t", t, bench) ==
false)
81 std::vector<double> bench(3);
85 if (test(
"t1", t1, bench) ==
false)
92 if (test(
"t2", t2, bench) ==
false)
99 if (test(
"t3", t3, bench) ==
false)
103 std::vector<double> bench1(9, 0);
110 if (test(
"skew", skew, bench1) ==
false)
118 if (test(
"t4", t4, bench) ==
false)
125 if (test(
"t5", t5, bench) ==
false)
132 if (test(
"t6", t6, bench) ==
false)
135 std::cout <<
"All tests succeed" << std::endl;
Implementation of a generic 2D array used as base class for matrices and vectors.
unsigned int getCols() const
Type * data
Address of the first element of the data array.
unsigned int size() const
Return the number of elements of the 2D array.
unsigned int getRows() const
Implementation of a matrix and operations on matrices.
Class that consider the case of a translation vector.
void set(double tx, double ty, double tz)
static vpTranslationVector cross(const vpTranslationVector &a, const vpTranslationVector &b)