YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
Quaternion.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#ifndef YARP_QUATERNION_H
7#define YARP_QUATERNION_H
8
9#include <yarp/math/api.h>
10#include <yarp/sig/Vector.h>
11#include <yarp/sig/Matrix.h>
13
14namespace yarp::math {
15class Quaternion;
16}
17
19{
20public:
21 Quaternion();
22 Quaternion(double x, double y, double z, double w);
23
24 double x() const;
25 double y() const;
26 double z() const;
27 double w() const;
28 double& x() ;
29 double& y() ;
30 double& z() ;
31 double& w() ;
32
33 std::string toString(int precision = -1, int width = -1) const;
34
38 double abs();
39
43 void normalize();
44
48 bool isValid() const;
49
53 Quaternion inverse() const;
54
58 double arg();
59
64 void fromAxisAngle(const yarp::sig::Vector &v);
65
71 void fromAxisAngle(const yarp::sig::Vector& axis, const double& angle);
72
73
75
101
128
135
140};
141
142#endif
contains the definition of a Matrix type
contains the definition of a Vector type
void fromRotationMatrix(const yarp::sig::Matrix &R)
Converts a rotation matrix to a quaternion.
double abs()
Computes the modulus of the quaternion.
yarp::sig::Vector toVector() const
Converts the quaternion to a vector of length 4.
yarp::sig::Matrix toRotationMatrix3x3() const
Converts a quaternion to a rotation matrix.
Quaternion inverse() const
Computes the inverse of the quaternion.
void normalize()
Normalizes the quaternion elements.
void fromAxisAngle(const yarp::sig::Vector &v)
Computes the quaternion from an axis-angle representation.
double arg()
Computes the argument or phase of the quaternion in radians.
yarp::sig::Matrix toRotationMatrix4x4() const
Converts a quaternion to a rotation matrix.
yarp::sig::Vector toAxisAngle()
bool isValid() const
Check if the quaternion is valid.
A class for a Matrix.
Definition Matrix.h:40
std::string toString() const
The main, catch-all namespace for YARP.
Definition dirs.h:16
#define YARP_math_API
Definition api.h:17