RzyzVector¶
- class RzyzVector(*args, **kwargs)¶
Bases:
RotationVector
Implementation of a rotation vector as \(R(z,y,z)\) Euler angle minimal representation.
Class that consider the case of the Euler \((\varphi,\theta,\psi)\) angles using the z-y-z convention, where \((\varphi,\theta,\psi)\) are respectively the rotation angles around the \(z\) , \(y\) and \(z\) axis.
\[R_{zyz}(\varphi,\theta,\psi) = R_z(\varphi) \; R_y(\theta) \; R_z(\psi)\]with
\[\begin{split}R_{z}(\varphi) = \left( \begin{array}{ccc} \cos \varphi & -\sin\varphi & 0\\\sin\varphi &\cos \varphi& 0 \\0 & 0 & 1 \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 z-y-z convention is given by:
\[\begin{split}R_{zyz}(\varphi,\theta,\psi) = \left( \begin{array}{ccc} \cos\varphi \cos\theta \cos\psi - \sin\varphi\sin\psi & -\cos\varphi \cos\theta \sin\psi -\sin\varphi\cos\psi & \cos\varphi \sin\theta \\\sin\varphi \cos\theta \cos\psi + \cos\varphi\sin\psi & -\sin\varphi \cos\theta \sin\psi +\cos\varphi\cos\psi & \sin\varphi \sin\theta \\-\sin\theta \cos\psi & \sin\theta \sin\psi & \cos\theta \end{array} \right) \end{split}\]The vpRzyzVector 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:
vpRzyzVector rzyz; rzyz[0] = M_PI_4; rzyz[1] = M_PI_2; rzyz[2] = M_PI;
You can also initialize the vector using operator<<(double) :
rzyz << 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:
rzyz = {M_PI_4, M_PI_2, M_PI};
To get the values [rad] use:
double r1 = rzyz[0]; double r2 = rzyz[1]; double r3 = rzyz[2];
The code below shows first how to initialize this representation of Euler angles, than how to construct a rotation matrix from a vpRzyzVector and finally how to extract the vpRzyzVector Euler angles from the build rotation matrix.
#include <visp3/core/vpMath.h> #include <visp3/core/vpRotationMatrix.h> #include <visp3/core/vpRzyzVector.h> #ifdef ENABLE_VISP_NAMESPACE using namespace VISP_NAMESPACE_NAME; #endif int main() { vpRzyzVector rzyz; // Initialise the Euler angles rzyz[0] = vpMath::rad( 45.f); // phi angle in rad/s around z axis rzyz[1] = vpMath::rad(-30.f); // theta angle in rad/s around y axis rzyz[2] = vpMath::rad( 90.f); // psi angle in rad/s around z axis // Construct a rotation matrix from the Euler angles vpRotationMatrix R(rzyz); // Extract the Euler angles around z,y,z axis from a rotation matrix rzyz.buildFrom(R); // Print the extracted Euler angles. Values are the same than the // one used for initialization std::cout << rzyz; // Since the rotation vector is 3 values column vector, the // transpose operation produce a row vector. vpRowVector rzyz_t = rzyz.t(); // Print the transpose row vector std::cout << rzyz_t << std::endl; }
Overloaded function.
__init__(self: visp._visp.core.RzyzVector) -> None
Default constructor that initialize all the 3 angles to zero.
__init__(self: visp._visp.core.RzyzVector, rzyz: visp._visp.core.RzyzVector) -> None
Copy constructor.
__init__(self: visp._visp.core.RzyzVector, R: visp._visp.core.RotationMatrix) -> None
__init__(self: visp._visp.core.RzyzVector, tu: visp._visp.core.ThetaUVector) -> None
__init__(self: visp._visp.core.RzyzVector, phi: float, theta: float, psi: float) -> None
Constructor from 3 angles (in radian).
- Parameters:
- phi
math:varphi angle around the \(z\) axis.
- theta
math:theta angle around the \(y\) axis.
- psi
math:psi angle around the \(z\) axis.
__init__(self: visp._visp.core.RzyzVector, rzyz: visp._visp.core.ColVector) -> None
__init__(self: visp._visp.core.RzyzVector, rzyz: list[float]) -> None
Methods
Overloaded function.
Overloaded function.
Inherited Methods
Overloaded function.
- return:
The corresponding std::vector<double>.
Return the number of rows of the 2D array.
Return the number of elements of the 2D array.
Overloaded function.
Overloaded function.
Overloaded function.
Set the size of the array and initialize all the values to zero.
Overloaded function.
Return the number of columns of the 2D array.
Numpy view of the underlying array data.
Return the sum square of all the elements \(r_{i}\) of the rotation vector r(m).
Operators
__doc__
Overloaded function.
__module__
Attributes
__annotations__
- __eq__(*args, **kwargs)¶
Overloaded function.
__eq__(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D) -> bool
__eq__(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D) -> bool
__eq__(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D) -> bool
- __getitem__(*args, **kwargs)¶
Overloaded function.
__getitem__(self: visp._visp.core.PoseVector, arg0: int) -> float
__getitem__(self: visp._visp.core.PoseVector, arg0: slice) -> numpy.ndarray[numpy.float64]
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: visp._visp.core.RzyzVector) -> None
Default constructor that initialize all the 3 angles to zero.
__init__(self: visp._visp.core.RzyzVector, rzyz: visp._visp.core.RzyzVector) -> None
Copy constructor.
__init__(self: visp._visp.core.RzyzVector, R: visp._visp.core.RotationMatrix) -> None
__init__(self: visp._visp.core.RzyzVector, tu: visp._visp.core.ThetaUVector) -> None
__init__(self: visp._visp.core.RzyzVector, phi: float, theta: float, psi: float) -> None
Constructor from 3 angles (in radian).
- Parameters:
- phi
math:varphi angle around the \(z\) axis.
- theta
math:theta angle around the \(y\) axis.
- psi
math:psi angle around the \(z\) axis.
__init__(self: visp._visp.core.RzyzVector, rzyz: visp._visp.core.ColVector) -> None
__init__(self: visp._visp.core.RzyzVector, rzyz: list[float]) -> None
- __mul__(*args, **kwargs)¶
Overloaded function.
__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.
__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.
__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.
__ne__(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D) -> bool
__ne__(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D) -> bool
__ne__(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D) -> bool
- __setitem__(*args, **kwargs)¶
Overloaded function.
__setitem__(self: visp._visp.core.PoseVector, arg0: int, arg1: float) -> None
__setitem__(self: visp._visp.core.PoseVector, arg0: slice, arg1: float) -> None
__setitem__(self: visp._visp.core.PoseVector, arg0: slice, arg1: numpy.ndarray[numpy.float64]) -> None
- buildFrom(*args, **kwargs)¶
Overloaded function.
buildFrom(self: visp._visp.core.RzyzVector, R: visp._visp.core.RotationMatrix) -> visp._visp.core.RzyzVector
Convert a rotation matrix into a \(R_{zyz}=(\varphi,\theta,\psi)\) Euler angles vector.
- Parameters:
- R
Rotation matrix used as input.
- Returns:
\(R_{zyz}=(\varphi,\theta,\psi)\) Euler angles vector.
buildFrom(self: visp._visp.core.RzyzVector, R: visp._visp.core.ThetaUVector) -> visp._visp.core.RzyzVector
- Returns:
\(R_{zyz}=(\varphi,\theta,\psi)\) Euler angles vector.
buildFrom(self: visp._visp.core.RzyzVector, rxyz: visp._visp.core.ColVector) -> visp._visp.core.RzyzVector
Construct a \(R_{zyz}=(\varphi,\theta,\psi)\) Euler angles vector from a 3-dim vector.
buildFrom(self: visp._visp.core.RzyzVector, rxyz: list[float]) -> visp._visp.core.RzyzVector
Construct a \(R_{zyx}=(\varphi,\theta,\psi)\) Euler angles vector from a 3-dim vector.
buildFrom(self: visp._visp.core.RzyzVector, phi: float, theta: float, psi: float) -> visp._visp.core.RzyzVector
Construction from 3 angles (in radian).
- Parameters:
- phi
math:varphi angle around the \(z\) axis.
- theta
math:theta angle around the \(y\) axis.
- psi
math:psi angle around the \(z\) axis.
- static conv2(*args, **kwargs)¶
Overloaded function.
conv2(M: visp._visp.core.ArrayDouble2D, kernel: visp._visp.core.ArrayDouble2D, mode: str) -> visp._visp.core.ArrayDouble2D
conv2(M: visp._visp.core.ArrayDouble2D, kernel: visp._visp.core.ArrayDouble2D, res: visp._visp.core.ArrayDouble2D, mode: str) -> None
conv2(M: visp._visp.core.ArrayDouble2D, kernel: visp._visp.core.ArrayDouble2D, mode: str) -> visp._visp.core.ArrayDouble2D
conv2(M: visp._visp.core.ArrayDouble2D, kernel: visp._visp.core.ArrayDouble2D, res: visp._visp.core.ArrayDouble2D, mode: str) -> None
- hadamard(self, m: visp._visp.core.ArrayDouble2D) visp._visp.core.ArrayDouble2D ¶
- insert(*args, **kwargs)¶
Overloaded function.
insert(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D, r: int, c: int) -> None
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.
- 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.
save(filename: str, A: visp._visp.core.ArrayDouble2D, binary: bool = false, header: str = ) -> bool
save(filename: str, A: visp._visp.core.ArrayDouble2D, binary: bool = false, header: str = ) -> bool
save(filename: str, A: visp._visp.core.ArrayDouble2D, binary: bool = false, header: str = ) -> bool
- 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.
t(self: visp._visp.core.RotationVector) -> visp._visp.core.RowVector
Return the transpose of the rotation vector.
t(self: visp._visp.core.ArrayDouble2D) -> visp._visp.core.ArrayDouble2D
- static view(*args, **kwargs)¶
Overloaded function.
view(A: visp._visp.core.ArrayDouble2D) -> visp._visp.core.ArrayDouble2D
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
¶