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 228 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 236 of file inertia.hpp.

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

◆ 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 244 of file inertia.hpp.

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

◆ 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 252 of file inertia.hpp.

252: 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 260 of file inertia.hpp.

261 : position(p.translation), mass(m.mass)
262 {
263 }

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 270 of file inertia.hpp.

271 {
272 Scalar new_mass = mass + m.mass;
273 return CenterOfMass(
274 new_mass,
275 Position<Scalar>((position(0) * mass + m.position(0) * m.mass) / new_mass,
276 (position(1) * mass + m.position(1) * m.mass) / new_mass,
277 (position(2) * mass + m.position(2) * m.mass) / new_mass));
278 }
CenterOfMass()
默认构造函数,初始化质心位置为 (0,0,0),质量为 0。Default constructor initializing position to (0,0,0) and mass to 0.
Definition inertia.hpp:236

◆ 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 285 of file inertia.hpp.

286 {
287 *this = *this + m;
288 return *this;
289 }

Field Documentation

◆ mass

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

质量值。Mass value.

Definition at line 232 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 231 of file inertia.hpp.


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