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

三维坐标轴类,继承自 Eigen::Matrix<Scalar, 3, 1>。 A 3D axis class, inheriting from Eigen::Matrix<Scalar, 3, 1>. More...

#include <transform.hpp>

Inheritance diagram for LibXR::Axis< Scalar >:
Collaboration diagram for LibXR::Axis< Scalar >:

Public Member Functions

 Axis ()
 默认构造函数,将向量初始化为 (0,0,0)。 Default constructor initializing the vector to (0,0,0).
 
 Axis (Scalar x, Scalar y, Scalar z)
 通过 (x, y, z) 坐标值构造轴向量。 Constructs an axis vector using (x, y, z) coordinates.
 
 Axis (const Axis &p)
 拷贝构造函数,复制另一个 Axis 对象。 Copy constructor to duplicate another Axis object.
 
Axis< Scalar > & operator= (const Eigen::Matrix< Scalar, 3, 1 > &p)
 赋值运算符重载,将 Eigen::Matrix<Scalar, 3, 1> 赋值给 Axis 对象。 Overloaded assignment operator to assign an Eigen::Matrix<Scalar, 3, 1> to an Axis object.
 
Axis< Scalar > & operator= (const Axis &p)
 赋值运算符重载,将另一个 Axis 对象赋值给当前对象。 Overloaded assignment operator to assign another Axis object to this object.
 

Static Public Member Functions

static Axis X ()
 返回 X 轴单位向量 (1,0,0)。 Returns the unit vector along the X-axis (1,0,0).
 
static Axis Y ()
 返回 Y 轴单位向量 (0,1,0)。 Returns the unit vector along the Y-axis (0,1,0).
 
static Axis Z ()
 返回 Z 轴单位向量 (0,0,1)。 Returns the unit vector along the Z-axis (0,0,1).
 

Detailed Description

template<typename Scalar>
class LibXR::Axis< Scalar >

三维坐标轴类,继承自 Eigen::Matrix<Scalar, 3, 1>。 A 3D axis class, inheriting from Eigen::Matrix<Scalar, 3, 1>.

该类用于表示三维空间中的单位向量或方向向量, 并提供了一些常见的轴向定义(X、Y、Z)。 This class represents unit vectors or directional vectors in 3D space and provides common axis definitions (X, Y, Z).

Template Parameters
Scalar数据类型,如 floatdouble。 The data type, such as float or double.

Definition at line 241 of file transform.hpp.

Constructor & Destructor Documentation

◆ Axis() [1/3]

template<typename Scalar >
LibXR::Axis< Scalar >::Axis ( )
inline

默认构造函数,将向量初始化为 (0,0,0)。 Default constructor initializing the vector to (0,0,0).

Definition at line 248 of file transform.hpp.

248: Eigen::Matrix<Scalar, 3, 1>(0, 0, 0) {}

◆ Axis() [2/3]

template<typename Scalar >
LibXR::Axis< Scalar >::Axis ( Scalar  x,
Scalar  y,
Scalar  z 
)
inline

通过 (x, y, z) 坐标值构造轴向量。 Constructs an axis vector using (x, y, z) coordinates.

Parameters
xX 轴分量。 The X-axis component.
yY 轴分量。 The Y-axis component.
zZ 轴分量。 The Z-axis component.

Definition at line 258 of file transform.hpp.

258: Eigen::Matrix<Scalar, 3, 1>(x, y, z) {}
constexpr auto min(T1 a, T2 b) -> typename std::common_type< T1, T2 >::type
计算两个数的最小值

◆ Axis() [3/3]

template<typename Scalar >
LibXR::Axis< Scalar >::Axis ( const Axis< Scalar > &  p)
inline

拷贝构造函数,复制另一个 Axis 对象。 Copy constructor to duplicate another Axis object.

Parameters
p要复制的 Axis 对象。 The Axis object to be copied.

Definition at line 266 of file transform.hpp.

266: Eigen::Matrix<Scalar, 3, 1>(p) {}

Member Function Documentation

◆ operator=() [1/2]

template<typename Scalar >
Axis< Scalar > & LibXR::Axis< Scalar >::operator= ( const Axis< Scalar > &  p)
inline

赋值运算符重载,将另一个 Axis 对象赋值给当前对象。 Overloaded assignment operator to assign another Axis object to this object.

该操作检查自赋值,并确保数据正确拷贝。 This operation checks for self-assignment and ensures correct data copying.

Parameters
p赋值的 Axis 对象。 The Axis object to be assigned.
Returns
返回赋值后的 Axis 对象引用。 Returns a reference to the assigned Axis object.

Definition at line 323 of file transform.hpp.

324 {
325 if (this != &p)
326 {
327 memcpy(this->data(), p.data(), 3 * sizeof(Scalar));
328 }
329 return *this;
330 }

◆ operator=() [2/2]

template<typename Scalar >
Axis< Scalar > & LibXR::Axis< Scalar >::operator= ( const Eigen::Matrix< Scalar, 3, 1 > &  p)
inline

赋值运算符重载,将 Eigen::Matrix<Scalar, 3, 1> 赋值给 Axis 对象。 Overloaded assignment operator to assign an Eigen::Matrix<Scalar, 3, 1> to an Axis object.

该操作直接拷贝 Eigen 矩阵的数据到 Axis,保证对象数据一致性。 This operation directly copies the data from an Eigen matrix to Axis, ensuring data consistency.

Parameters
p赋值的 Eigen::Matrix<Scalar, 3, 1> 矩阵。 The Eigen::Matrix<Scalar, 3, 1> matrix to be assigned.
Returns
返回赋值后的 Axis 对象引用。 Returns a reference to the assigned Axis object.

Definition at line 306 of file transform.hpp.

307 {
308 memcpy(this->data(), p.data(), 3 * sizeof(Scalar));
309 return *this;
310 }

◆ X()

template<typename Scalar >
static Axis LibXR::Axis< Scalar >::X ( )
inlinestatic

返回 X 轴单位向量 (1,0,0)。 Returns the unit vector along the X-axis (1,0,0).

Returns
X 轴单位向量。 The unit vector along the X-axis.

Definition at line 274 of file transform.hpp.

274{ return Axis(1., 0., 0.); }
Axis()
默认构造函数,将向量初始化为 (0,0,0)。 Default constructor initializing the vector to (0,0,0).

◆ Y()

template<typename Scalar >
static Axis LibXR::Axis< Scalar >::Y ( )
inlinestatic

返回 Y 轴单位向量 (0,1,0)。 Returns the unit vector along the Y-axis (0,1,0).

Returns
Y 轴单位向量。 The unit vector along the Y-axis.

Definition at line 282 of file transform.hpp.

282{ return Axis(0., 1., 0.); }

◆ Z()

template<typename Scalar >
static Axis LibXR::Axis< Scalar >::Z ( )
inlinestatic

返回 Z 轴单位向量 (0,0,1)。 Returns the unit vector along the Z-axis (0,0,1).

Returns
Z 轴单位向量。 The unit vector along the Z-axis.

Definition at line 290 of file transform.hpp.

290{ return Axis(0., 0., 1.); }

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