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 >:
[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.
 
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< 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 1138 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 1156 of file transform.hpp.

1158 {
1159 }
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 1203 of file transform.hpp.

1204 {
1205 return Transform(Eigen::Quaternion<Scalar>(rotation * t.rotation),
1206 Eigen::Matrix<Scalar, 3, 1>(translation + rotation * t.translation));
1207 }
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 1215 of file transform.hpp.

1216 {
1217 return Transform(rotation / t.rotation, translation - t.translation);
1218 }

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

1180 {
1181 rotation = a;
1182 return *this;
1183 }

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

1192 {
1193 translation = p;
1194 return *this;
1195 }

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

1168 {
1169 rotation = q;
1170 return *this;
1171 }

Field Documentation

◆ rotation

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

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

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


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