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 1119 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 1137 of file transform.hpp.

1139 {
1140 }
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 1184 of file transform.hpp.

1185 {
1186 return Transform(Eigen::Quaternion<Scalar>(rotation * t.rotation),
1187 Eigen::Matrix<Scalar, 3, 1>(translation + rotation * t.translation));
1188 }
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 1196 of file transform.hpp.

1197 {
1198 return Transform(rotation / t.rotation, translation - t.translation);
1199 }

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

1161 {
1162 rotation = a;
1163 return *this;
1164 }

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

1173 {
1174 translation = p;
1175 return *this;
1176 }

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

1149 {
1150 rotation = q;
1151 return *this;
1152 }

Field Documentation

◆ rotation

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

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

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


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