libxr 1.0
Want to be the best embedded framework
Loading...
Searching...
No Matches
LibXR::Transform< Scalar > Class Template Reference

表示三维空间中的刚体变换,包括旋转和位移。Represents rigid body transformations in 3D space, including rotation and translation. More...

#include <transform.hpp>

Collaboration diagram for LibXR::Transform< Scalar >:

Public Member Functions

 Transform ()=default
 默认构造函数,创建单位变换。Default constructor creating an identity transformation.
 
 Transform (const Quaternion< Scalar > &rotation, const Position< Scalar > &translation)
 使用给定的旋转和位移构造变换。Constructs a transformation with the given rotation and translation.
 
Transformoperator= (const Quaternion< Scalar > &q)
 赋值运算符,将旋转部分设置为给定的四元数。Assignment operator setting the rotation component to the given quaternion.
 
Transformoperator= (const Eigen::AngleAxis< Scalar > &a)
 赋值运算符,将旋转部分设置为给定的旋转轴-角度表示。Assignment operator setting the rotation component using an axis-angle representation.
 
Transformoperator= (const Position< Scalar > &p)
 赋值运算符,将平移部分设置为给定的位移。Assignment operator setting the translation component to the given position.
 
Transform operator+ (const Transform &t) const
 计算当前变换与另一个变换的组合。Computes the composition of the current transformation with another transformation.
 
Transform operator- (const Transform &t) const
 计算当前变换与另一个变换的相对变换。Computes the relative transformation between the current transformation and another transformation.
 

Data Fields

Quaternion< Scalarrotation
 
Position< Scalartranslation
 

Detailed Description

template<typename Scalar = DefaultScalar>
class LibXR::Transform< Scalar >

表示三维空间中的刚体变换,包括旋转和位移。Represents rigid body transformations in 3D space, including rotation and translation.

Template Parameters
Scalar数据类型,默认为 DefaultScalar。Data type, defaulting to DefaultScalar.

Definition at line 1091 of file transform.hpp.

Constructor & Destructor Documentation

◆ Transform()

template<typename Scalar = DefaultScalar>
LibXR::Transform< Scalar >::Transform ( const Quaternion< Scalar > &  rotation,
const Position< Scalar > &  translation 
)
inline

使用给定的旋转和位移构造变换。Constructs a transformation with the given rotation and translation.

Parameters
rotation旋转四元数。Rotation quaternion.
translation平移向量。Translation vector.

Definition at line 1109 of file transform.hpp.

1111 {
1112 }
Quaternion< Scalar > rotation
Position< Scalar > translation

Member Function Documentation

◆ operator+()

template<typename Scalar = DefaultScalar>
Transform LibXR::Transform< Scalar >::operator+ ( const Transform< Scalar > &  t) const
inline

计算当前变换与另一个变换的组合。Computes the composition of the current transformation with another transformation.

Parameters
t另一个变换。Another transformation.
Returns
组合后的变换。Resulting transformation.

Definition at line 1156 of file transform.hpp.

1157 {
1158 return Transform(Eigen::Quaternion<Scalar>(rotation * t.rotation),
1159 Eigen::Matrix<Scalar, 3, 1>(translation + rotation * t.translation));
1160 }
Transform()=default
默认构造函数,创建单位变换。Default constructor creating an identity transformation.
constexpr auto min(T1 a, T2 b) -> typename std::common_type< T1, T2 >::type
计算两个数的最小值

◆ operator-()

template<typename Scalar = DefaultScalar>
Transform LibXR::Transform< Scalar >::operator- ( const Transform< Scalar > &  t) const
inline

计算当前变换与另一个变换的相对变换。Computes the relative transformation between the current transformation and another transformation.

Parameters
t另一个变换。Another transformation.
Returns
计算得到的相对变换。Resulting relative transformation.

Definition at line 1168 of file transform.hpp.

1169 {
1170 return Transform(rotation / t.rotation, translation - t.translation);
1171 }

◆ operator=() [1/3]

template<typename Scalar = DefaultScalar>
Transform & LibXR::Transform< Scalar >::operator= ( const Eigen::AngleAxis< Scalar > &  a)
inline

赋值运算符,将旋转部分设置为给定的旋转轴-角度表示。Assignment operator setting the rotation component using an axis-angle representation.

Parameters
a旋转轴-角度对象。Axis-angle representation.
Returns
当前 Transform 对象的引用。Reference to the current Transform object.

Definition at line 1132 of file transform.hpp.

1133 {
1134 rotation = a;
1135 return *this;
1136 }

◆ operator=() [2/3]

template<typename Scalar = DefaultScalar>
Transform & LibXR::Transform< Scalar >::operator= ( const Position< Scalar > &  p)
inline

赋值运算符,将平移部分设置为给定的位移。Assignment operator setting the translation component to the given position.

Parameters
p平移向量。Translation vector.
Returns
当前 Transform 对象的引用。Reference to the current Transform object.

Definition at line 1144 of file transform.hpp.

1145 {
1146 translation = p;
1147 return *this;
1148 }

◆ operator=() [3/3]

template<typename Scalar = DefaultScalar>
Transform & LibXR::Transform< Scalar >::operator= ( const Quaternion< Scalar > &  q)
inline

赋值运算符,将旋转部分设置为给定的四元数。Assignment operator setting the rotation component to the given quaternion.

Parameters
q旋转四元数。Rotation quaternion.
Returns
当前 Transform 对象的引用。Reference to the current Transform object.

Definition at line 1120 of file transform.hpp.

1121 {
1122 rotation = q;
1123 return *this;
1124 }

Field Documentation

◆ rotation

template<typename Scalar = DefaultScalar>
Quaternion<Scalar> LibXR::Transform< Scalar >::rotation

旋转部分,使用四元数表示。Rotation component represented by a quaternion.

Definition at line 1094 of file transform.hpp.

◆ translation

template<typename Scalar = DefaultScalar>
Position<Scalar> LibXR::Transform< Scalar >::translation

平移部分,使用三维向量表示。Translation component represented by a 3D vector.

Definition at line 1096 of file transform.hpp.


The documentation for this class was generated from the following file: