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

质心信息表示类。Represents the center of mass information. More...

#include <inertia.hpp>

Public Member Functions

 CenterOfMass ()
 默认构造函数,初始化质心位置为 (0,0,0),质量为 0。Default constructor initializing position to (0,0,0) and mass to 0.
 
 CenterOfMass (Scalar m, const LibXR::Position< Scalar > &p)
 使用质量和位置构造质心对象。Constructs a center of mass object using mass and position.
 
 CenterOfMass (Scalar m, const Eigen::Matrix< Scalar, 3, 1 > &p)
 使用质量和 Eigen 3D 向量构造质心对象。Constructs a center of mass object using mass and Eigen 3D vector.
 
 CenterOfMass (const Inertia< Scalar > &m, const Transform< Scalar > &p)
 从惯性对象和变换构造质心对象。Constructs a center of mass object from inertia and transformation.
 
CenterOfMass operator+ (const CenterOfMass &m) const
 计算两个质心的合成。Computes the combined center of mass.
 
CenterOfMassoperator+= (const CenterOfMass &m)
 质心累加运算符。Accumulation operator for center of mass.
 

Data Fields

Eigen::Matrix< Scalar, 3, 1 > position
 质心位置。Center of mass position.
 
Scalar mass
 质量值。Mass value.
 

Detailed Description

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

质心信息表示类。Represents the center of mass information.

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

Definition at line 218 of file inertia.hpp.

Constructor & Destructor Documentation

◆ CenterOfMass() [1/4]

template<typename Scalar = DefaultScalar>
LibXR::CenterOfMass< Scalar >::CenterOfMass ( )
inline

默认构造函数,初始化质心位置为 (0,0,0),质量为 0。Default constructor initializing position to (0,0,0) and mass to 0.

Definition at line 226 of file inertia.hpp.

226: position(0., 0., 0.), mass(0.) {}
Eigen::Matrix< Scalar, 3, 1 > position
质心位置。Center of mass position.
Definition inertia.hpp:221
Scalar mass
质量值。Mass value.
Definition inertia.hpp:222

◆ CenterOfMass() [2/4]

template<typename Scalar = DefaultScalar>
LibXR::CenterOfMass< Scalar >::CenterOfMass ( Scalar  m,
const LibXR::Position< Scalar > &  p 
)
inline

使用质量和位置构造质心对象。Constructs a center of mass object using mass and position.

Parameters
m质量值。Mass value.
p质心位置。Center of mass position.

Definition at line 234 of file inertia.hpp.

234: position(p), mass(m) {}
constexpr auto min(T1 a, T2 b) -> typename std::common_type< T1, T2 >::type
计算两个数的最小值

◆ CenterOfMass() [3/4]

template<typename Scalar = DefaultScalar>
LibXR::CenterOfMass< Scalar >::CenterOfMass ( Scalar  m,
const Eigen::Matrix< Scalar, 3, 1 > &  p 
)
inline

使用质量和 Eigen 3D 向量构造质心对象。Constructs a center of mass object using mass and Eigen 3D vector.

Parameters
m质量值。Mass value.
p3D 位置向量。3D position vector.

Definition at line 242 of file inertia.hpp.

242: position(p), mass(m) {}

◆ CenterOfMass() [4/4]

template<typename Scalar = DefaultScalar>
LibXR::CenterOfMass< Scalar >::CenterOfMass ( const Inertia< Scalar > &  m,
const Transform< Scalar > &  p 
)
inline

从惯性对象和变换构造质心对象。Constructs a center of mass object from inertia and transformation.

Parameters
m惯性对象。Inertia object.
p变换对象。Transformation object.

Definition at line 250 of file inertia.hpp.

251 : position(p.translation), mass(m.mass)
252 {
253 }
Position< Scalar > translation

Member Function Documentation

◆ operator+()

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

计算两个质心的合成。Computes the combined center of mass.

Parameters
m另一个质心对象。Another center of mass object.
Returns
合并后的质心对象。Combined center of mass object.

Definition at line 260 of file inertia.hpp.

261 {
262 Scalar new_mass = mass + m.mass;
263 return CenterOfMass(
264 new_mass,
265 Position<Scalar>((position(0) * mass + m.position(0) * m.mass) / new_mass,
266 (position(1) * mass + m.position(1) * m.mass) / new_mass,
267 (position(2) * mass + m.position(2) * m.mass) / new_mass));
268 }
CenterOfMass()
默认构造函数,初始化质心位置为 (0,0,0),质量为 0。Default constructor initializing position to (0,0,0) and mass to 0.
Definition inertia.hpp:226

◆ operator+=()

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

质心累加运算符。Accumulation operator for center of mass.

Parameters
m另一个质心对象。Another center of mass object.
Returns
当前对象的引用。Reference to the current object.

Definition at line 275 of file inertia.hpp.

276 {
277 *this = *this + m;
278 return *this;
279 }

Field Documentation

◆ mass

template<typename Scalar = DefaultScalar>
Scalar LibXR::CenterOfMass< Scalar >::mass

质量值。Mass value.

Definition at line 222 of file inertia.hpp.

◆ position

template<typename Scalar = DefaultScalar>
Eigen::Matrix<Scalar, 3, 1> LibXR::CenterOfMass< Scalar >::position

质心位置。Center of mass position.

Definition at line 221 of file inertia.hpp.


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