42 #include <visp3/core/vpThetaUVector.h>
45 const double vpThetaUVector::minimum = 0.0001;
128 const unsigned int val_3 = 3;
129 for (
unsigned int i = 0; i < val_3; ++i) {
142 const unsigned int index_0 = 0;
143 const unsigned int index_1 = 1;
144 const unsigned int index_2 = 2;
146 s = ((R[1][0] - R[0][1]) * (R[1][0] - R[0][1])) + ((R[index_2][0] - R[0][index_2]) * (R[index_2][0] - R[0][index_2])) +
147 ((R[index_2][index_1] - R[index_1][index_2]) * (R[index_2][index_1] - R[index_1][index_2]));
149 c = ((R[index_0][index_0] + R[index_1][index_1] + R[index_2][index_2]) - 1.0) / 2.0;
153 if ((1 + c) > minimum)
157 data[index_0] = (R[index_2][index_1] - R[index_1][index_2]) / (2 * sinc);
158 data[index_1] = (R[index_0][index_2] - R[index_2][index_0]) / (2 * sinc);
159 data[index_2] = (R[index_1][index_0] - R[index_0][index_1]) / (2 * sinc);
164 if ((R[0][0] - c) > std::numeric_limits<double>::epsilon()) {
165 x = sqrt((R[0][0] - c) / (1 - c));
169 if ((R[1][1] - c) > std::numeric_limits<double>::epsilon()) {
170 y = sqrt((R[1][1] - c) / (1 - c));
174 if ((R[index_2][index_2] - c) > std::numeric_limits<double>::epsilon()) {
175 z = sqrt((R[index_2][index_2] - c) / (1 - c));
178 if ((x > y) && (x > z)) {
179 if ((R[index_2][index_1] - R[index_1][index_2]) < 0) {
190 if ((R[index_0][index_2] - R[index_2][index_0]) < 0) {
201 if ((R[1][0] - R[0][1]) < 0) {
211 data[index_0] = theta * x;
212 data[index_1] = theta * y;
213 data[index_2] = theta * z;
265 if (tu.size() != 3) {
269 const unsigned int val_3 = 3;
270 for (
unsigned int i = 0; i < val_3; ++i) {
282 if (tu.
size() != 3) {
286 const unsigned int val_3 = 3;
287 for (
unsigned int i = 0; i < val_3; ++i) {
299 const unsigned int index_0 = 0;
300 const unsigned int index_1 = 1;
301 const unsigned int index_2 = 2;
334 for (
unsigned int i = 0; i <
dsize; ++i) {
374 unsigned int l_size =
size();
375 for (
unsigned int i = 0; i < l_size; ++i) {
420 if (std::fabs(theta) <= std::numeric_limits<double>::epsilon()) {
424 const unsigned int val_3 = 3;
425 for (
unsigned int i = 0; i < val_3; ++i) {
426 u[i] =
data[i] / theta;
458 const unsigned int index_0 = 0;
459 const unsigned int index_1 = 1;
460 const unsigned int index_2 = 2;
497 if (std::fabs(theta) <= std::numeric_limits<double>::epsilon()) {
501 const unsigned int val_3 = 3;
502 for (
unsigned int i = 0; i < val_3; ++i) {
503 u[i] =
data[i] / theta;
521 double c = 2 * std::acos((std::cos(a_2) * std::cos(b_2)) - (
vpColVector::dotProd(a_hat_sin_2, b_hat_sin_2)));
522 vpColVector d = ((std::sin(a_2) * std::cos(b_2) * a_hat) + (std::cos(a_2) * std::sin(b_2) * b_hat)) +
524 d = (c * d) / std::sin(c / 2);
529 #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
553 if (list.size() >
size()) {
556 "Cannot set theta u vector out of bounds. It has only %d values while you try to initialize with %d values",
557 size(), list.size()));
559 std::copy(list.begin(), list.end(),
data);
double * data
Address of the first element of the data array.
unsigned int dsize
Current array size (rowNum * colNum)
unsigned int size() const
Return the number of elements of the 2D array.
Implementation of column vector and the associated operations.
static double dotProd(const vpColVector &a, const vpColVector &b)
static vpColVector crossProd(const vpColVector &a, const vpColVector &b)
void resize(unsigned int i, bool flagNullify=true)
error that can be emitted by ViSP classes.
@ dimensionError
Bad dimension.
Implementation of an homogeneous matrix and operations on such kind of matrices.
void extract(vpRotationMatrix &R) const
static double sinc(double x)
static int sign(double x)
Implementation of a pose vector and operations on poses.
Implementation of a rotation vector as quaternion angle minimal representation.
Implementation of a rotation matrix and operations on such kind of matrices.
Implementation of a generic rotation vector.
Implementation of a rotation vector as Euler angle minimal representation.
Implementation of a rotation vector as Euler angle minimal representation.
Implementation of a rotation vector as Euler angle minimal representation.
Implementation of a rotation vector as axis-angle minimal representation.
vpThetaUVector operator*(const vpThetaUVector &tu_b) const
void extract(double &theta, vpColVector &u) const
vpThetaUVector & buildFrom(const vpHomogeneousMatrix &M)
vpThetaUVector & operator=(const vpColVector &tu)