RxyzVector

class RxyzVector(*args, **kwargs)

Bases: RotationVector

Implementation of a rotation vector as \(R(x,y,z)\) Euler angle minimal representation.

Class that consider the case of the Euler \((\varphi,\theta,\psi)\) angle using the x-y-z convention, where \((\varphi,\theta,\psi)\) are respectively the rotation angles around the \(x\) , \(y\) and \(z\) axis.

\[R_{xyz}(\varphi,\theta,\psi) = R_x(\varphi) \; R_y(\theta) \; R_z(\psi)\]

with

\[\begin{split}R_{x}(\varphi) = \left( \begin{array}{ccc} 1 & 0 & 0 \\0 &\cos \varphi & -\sin\varphi \\0 &\sin \varphi & \cos\varphi \\\end{array} \right) \; R_{y}(\theta) = \left( \begin{array}{ccc} \cos \theta & 0 & \sin\theta\\0 & 1 & 0 \\-\sin\theta & 0 &\cos \theta \end{array} \right) \; R_{z}(\psi) = \left( \begin{array}{ccc} \cos \psi & -\sin\psi & 0\\\sin\psi &\cos \psi& 0 \\0 & 0 & 1 \end{array} \right)\end{split}\]

The rotation matrix corresponding to the x-y-z convention is given by:

\[\begin{split}R_{xyz}(\varphi,\theta,\psi) = \left( \begin{array}{ccc} \cos\theta \cos\psi & -\cos\theta \sin\psi & \sin\theta \\\sin\varphi \sin\theta \cos\psi + \cos\varphi\sin\psi & -\sin\varphi \sin\theta \sin\psi +\cos\varphi\cos\psi & -\sin\varphi \cos\theta \\-\cos\varphi \sin\theta \cos\psi + \sin\varphi\sin\psi & \cos\varphi \sin\theta \sin\psi +\sin\varphi\cos\psi & \cos\varphi \cos\theta \end{array} \right) \end{split}\]

The vpRxyzVector class is derived from vpRotationVector .

From the implementation point of view, it is nothing more than an array of three doubles with values in [rad].

You can set values [rad] accessing each element:

vpRxyzVector rxyz;
rxyz[0] = M_PI_4;
rxyz[1] = M_PI_2;
rxyz[2] = M_PI;

You can also initialize the vector using operator<<(double) :

rxyz << M_PI_4, M_PI_2, M_PI;

Or you can also initialize the vector from a list of doubles if ViSP is build with c++11 enabled:

rxyz = {M_PI_4, M_PI_2, M_PI};

To get the values [rad] use:

double rx = rxyz[0];
double ry = rxyz[1];
double rz = rxyz[2];

The code below shows first how to initialize this representation of Euler angles, than how to construct a rotation matrix from a vpRxyzVector and finally how to extract the vpRxyzVector Euler angles from the build rotation matrix.

#include <iostream>
#include <visp3/core/vpMath.h>
#include <visp3/core/vpRotationMatrix.h>
#include <visp3/core/vpRxyzVector.h>

#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
#endif

int main()
{
  vpRxyzVector rxyz;

  // Initialise the Euler angles
  rxyz[0] = vpMath::rad( 45.f); // phi   angle in rad around x axis
  rxyz[1] = vpMath::rad(-30.f); // theta angle in rad around y axis
  rxyz[2] = vpMath::rad( 90.f); // psi   angle in rad around z axis

  // Construct a rotation matrix from the Euler angles
  vpRotationMatrix R(rxyz);

  // Extract the Euler angles around x,y,z axis from a rotation matrix
  rxyz.buildFrom(R);

  // Print the extracted Euler angles. Values are the same than the
  // one used for initialization
  std::cout << rxyz;

  // Since the rotation vector is 3 values column vector, the
  // transpose operation produce a row vector.
  vpRowVector rxyz_t = rxyz.t();

  // Print the transpose row vector
  std::cout << rxyz_t << std::endl;
}

Overloaded function.

  1. __init__(self: visp._visp.core.RxyzVector) -> None

Default constructor that initialize all the 3 angles to zero.

  1. __init__(self: visp._visp.core.RxyzVector, rxyz: visp._visp.core.RxyzVector) -> None

Copy constructor.

  1. __init__(self: visp._visp.core.RxyzVector, phi: float, theta: float, psi: float) -> None

Constructor from 3 angles (in radian).

Parameters:
phi

math:varphi angle around the \(x\) axis.

theta

math:theta angle around the \(y\) axis.

psi

math:psi angle around the \(z\) axis.

  1. __init__(self: visp._visp.core.RxyzVector, R: visp._visp.core.RotationMatrix) -> None

  2. __init__(self: visp._visp.core.RxyzVector, tu: visp._visp.core.ThetaUVector) -> None

  3. __init__(self: visp._visp.core.RxyzVector, rxyz: visp._visp.core.ColVector) -> None

  4. __init__(self: visp._visp.core.RxyzVector, rxyz: list[float]) -> None

Methods

__init__

Overloaded function.

buildFrom

Overloaded function.

Inherited Methods

getMaxValue

insert

Overloaded function.

getCols

Return the number of columns of the 2D array.

save

Overloaded function.

size

Return the number of elements of the 2D array.

numpy

Numpy view of the underlying array data.

conv2

Overloaded function.

reshape

sumSquare

Return the sum square of all the elements \(r_{i}\) of the rotation vector r(m).

getMinValue

toStdVector

return:

The corresponding std::vector<double>.

t

Overloaded function.

resize

Set the size of the array and initialize all the values to zero.

hadamard

saveYAML

view

Overloaded function.

getRows

Return the number of rows of the 2D array.

insertStatic

Operators

__doc__

__init__

Overloaded function.

__module__

Attributes

__annotations__

__hash__

__eq__(*args, **kwargs)

Overloaded function.

  1. __eq__(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D) -> bool

  2. __eq__(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D) -> bool

  3. __eq__(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D) -> bool

__getitem__(*args, **kwargs)

Overloaded function.

  1. __getitem__(self: visp._visp.core.PoseVector, arg0: int) -> float

  2. __getitem__(self: visp._visp.core.PoseVector, arg0: slice) -> numpy.ndarray[numpy.float64]

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: visp._visp.core.RxyzVector) -> None

Default constructor that initialize all the 3 angles to zero.

  1. __init__(self: visp._visp.core.RxyzVector, rxyz: visp._visp.core.RxyzVector) -> None

Copy constructor.

  1. __init__(self: visp._visp.core.RxyzVector, phi: float, theta: float, psi: float) -> None

Constructor from 3 angles (in radian).

Parameters:
phi

math:varphi angle around the \(x\) axis.

theta

math:theta angle around the \(y\) axis.

psi

math:psi angle around the \(z\) axis.

  1. __init__(self: visp._visp.core.RxyzVector, R: visp._visp.core.RotationMatrix) -> None

  2. __init__(self: visp._visp.core.RxyzVector, tu: visp._visp.core.ThetaUVector) -> None

  3. __init__(self: visp._visp.core.RxyzVector, rxyz: visp._visp.core.ColVector) -> None

  4. __init__(self: visp._visp.core.RxyzVector, rxyz: list[float]) -> None

__mul__(*args, **kwargs)

Overloaded function.

  1. __mul__(self: visp._visp.core.RotationVector, x: float) -> visp._visp.core.ColVector

Operator that allows to multiply each element of a rotation vector by a scalar.

Parameters:
x

The scalar.

Returns:

The rotation vector multiplied by the scalar as a column vector. The current rotation vector (*this) is unchanged.

  1. __mul__(self: visp._visp.core.RotationVector, x: float) -> visp._visp.core.ColVector

Operator that allows to multiply each element of a rotation vector by a scalar.

Parameters:
x

The scalar.

Returns:

The rotation vector multiplied by the scalar as a column vector. The current rotation vector (*this) is unchanged.

  1. __mul__(self: visp._visp.core.RotationVector, x: float) -> visp._visp.core.ColVector

Operator that allows to multiply each element of a rotation vector by a scalar.

Parameters:
x

The scalar.

Returns:

The rotation vector multiplied by the scalar as a column vector. The current rotation vector (*this) is unchanged.

__ne__(*args, **kwargs)

Overloaded function.

  1. __ne__(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D) -> bool

  2. __ne__(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D) -> bool

  3. __ne__(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D) -> bool

__setitem__(*args, **kwargs)

Overloaded function.

  1. __setitem__(self: visp._visp.core.PoseVector, arg0: int, arg1: float) -> None

  2. __setitem__(self: visp._visp.core.PoseVector, arg0: slice, arg1: float) -> None

  3. __setitem__(self: visp._visp.core.PoseVector, arg0: slice, arg1: numpy.ndarray[numpy.float64]) -> None

buildFrom(*args, **kwargs)

Overloaded function.

  1. buildFrom(self: visp._visp.core.RxyzVector, R: visp._visp.core.RotationMatrix) -> visp._visp.core.RxyzVector

Convert a rotation matrix into a \(R_{xyz}=(\varphi,\theta,\psi)\) Euler angles vector.

Parameters:
R

Rotation matrix used as input.

Returns:

\(R_{xyz}=(\varphi,\theta,\psi)\) Euler angles vector.

  1. buildFrom(self: visp._visp.core.RxyzVector, tu: visp._visp.core.ThetaUVector) -> visp._visp.core.RxyzVector

Parameters:
tu

math:theta {bf u} representation of a rotation used here as input.

Returns:

\(R_{xyz}=(\varphi,\theta,\psi)\) Euler angles vector.

  1. buildFrom(self: visp._visp.core.RxyzVector, rxyz: visp._visp.core.ColVector) -> visp._visp.core.RxyzVector

Construct a \(R_{xyz}=(\varphi,\theta,\psi)\) Euler angles vector from a 3-dim vector.

  1. buildFrom(self: visp._visp.core.RxyzVector, rxyz: list[float]) -> visp._visp.core.RxyzVector

Construct a \(R_{xyz}=(\varphi,\theta,\psi)\) Euler angles vector from a 3-dim vector.

  1. buildFrom(self: visp._visp.core.RxyzVector, phi: float, theta: float, psi: float) -> visp._visp.core.RxyzVector

Construction from 3 angles (in radian).

Parameters:
phi

math:varphi angle around the \(x\) axis.

theta

math:theta angle around the \(y\) axis.

psi

math:psi angle around the \(z\) axis.

static conv2(*args, **kwargs)

Overloaded function.

  1. conv2(M: visp._visp.core.ArrayDouble2D, kernel: visp._visp.core.ArrayDouble2D, mode: str) -> visp._visp.core.ArrayDouble2D

  2. conv2(M: visp._visp.core.ArrayDouble2D, kernel: visp._visp.core.ArrayDouble2D, res: visp._visp.core.ArrayDouble2D, mode: str) -> None

  3. conv2(M: visp._visp.core.ArrayDouble2D, kernel: visp._visp.core.ArrayDouble2D, mode: str) -> visp._visp.core.ArrayDouble2D

  4. conv2(M: visp._visp.core.ArrayDouble2D, kernel: visp._visp.core.ArrayDouble2D, res: visp._visp.core.ArrayDouble2D, mode: str) -> None

getCols(self) int

Return the number of columns of the 2D array.

Note

See getRows() , size()

getMaxValue(self) float
getMinValue(self) float
getRows(self) int

Return the number of rows of the 2D array.

Note

See getCols() , size()

hadamard(self, m: visp._visp.core.ArrayDouble2D) visp._visp.core.ArrayDouble2D
insert(*args, **kwargs)

Overloaded function.

  1. insert(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D, r: int, c: int) -> None

  2. insert(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D, B: visp._visp.core.ArrayDouble2D, r: int, c: int) -> visp._visp.core.ArrayDouble2D

static insertStatic(A: visp._visp.core.ArrayDouble2D, B: visp._visp.core.ArrayDouble2D, C: visp._visp.core.ArrayDouble2D, r: int, c: int) None
numpy(self) numpy.ndarray[numpy.float64]

Numpy view of the underlying array data. This numpy view can be used to directly modify the array.

reshape(self, nrows: int, ncols: int) None
resize(self, nrows: int, ncols: int, flagNullify: bool = true, recopy_: bool = true) None

Set the size of the array and initialize all the values to zero.

Parameters:
nrows: int

number of rows.

ncols: int

number of column.

flagNullify: bool = true

if true, then the array is re-initialized to 0 after resize. If false, the initial values from the common part of the array (common part between old and new version of the array) are kept. Default value is true.

recopy_: bool = true

if true, will perform an explicit recopy of the old data.

static save(*args, **kwargs)

Overloaded function.

  1. save(filename: str, A: visp._visp.core.ArrayDouble2D, binary: bool = false, header: str = ) -> bool

  2. save(filename: str, A: visp._visp.core.ArrayDouble2D, binary: bool = false, header: str = ) -> bool

  3. save(filename: str, A: visp._visp.core.ArrayDouble2D, binary: bool = false, header: str = ) -> bool

static saveYAML(filename: str, A: visp._visp.core.ArrayDouble2D, header: str =) bool
size(self) int

Return the number of elements of the 2D array.

sumSquare(self) float

Return the sum square of all the elements \(r_{i}\) of the rotation vector r(m).

Returns:

The value

\[\sum{i=0}^{m} r_i^{2}\]

.

t(*args, **kwargs)

Overloaded function.

  1. t(self: visp._visp.core.RotationVector) -> visp._visp.core.RowVector

Return the transpose of the rotation vector.

  1. t(self: visp._visp.core.ArrayDouble2D) -> visp._visp.core.ArrayDouble2D

toStdVector(self) list[float]
Returns:

The corresponding std::vector<double>.

static view(*args, **kwargs)

Overloaded function.

  1. view(A: visp._visp.core.ArrayDouble2D) -> visp._visp.core.ArrayDouble2D

  2. view(np_array: numpy.ndarray[numpy.float64]) -> visp._visp.core.ArrayDouble2D

Construct a 2D ViSP array that is a view of a numpy array. When it is modified, the numpy array is also modified. It cannot be resized.

Parameters:
np_array

The numpy array to copy.

__hash__ = None