libxr
Embedded C++ framework for bare-metal, RTOS and Linux
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 >:
[legend]

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.
 
Transform & operator= (const Quaternion< Scalar > &q)
 赋值运算符,将旋转部分设置为给定的四元数。 Assignment operator setting the rotation component to the given quaternion.
 
Transform & operator= (const Eigen::AngleAxis< Scalar > &a)
 赋值运算符,将旋转部分设置为给定的旋转轴-角度表示。 Assignment operator setting the rotation component using an axis-angle representation.
 
Transform & operator= (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.
 

Public Attributes

Quaternion< Scalar > rotation
 
Position< Scalar > translation
 

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 1174 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 1192 of file transform.hpp.

1194 {
1195 }
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 1240 of file transform.hpp.

1241 {
1242 return Transform(Eigen::Quaternion<Scalar>(rotation * t.rotation),
1243 Eigen::Matrix<Scalar, 3, 1>(translation + rotation * t.translation));
1244 }
Transform()=default
默认构造函数,创建单位变换。 Default constructor creating an identity transformation.

◆ 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 1253 of file transform.hpp.

1254 {
1255 return Transform(rotation / t.rotation,
1256 Eigen::Matrix<Scalar, 3, 1>(translation - t.translation));
1257 }

◆ 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 1216 of file transform.hpp.

1217 {
1218 rotation = Eigen::Quaternion<Scalar>(a);
1219 return *this;
1220 }

◆ 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 1228 of file transform.hpp.

1229 {
1230 translation = p;
1231 return *this;
1232 }

◆ 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 1203 of file transform.hpp.

1204 {
1205 rotation = q;
1206 return *this;
1207 }

Member Data Documentation

◆ rotation

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

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

Definition at line 1177 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 1179 of file transform.hpp.


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