当前位置: 首页>>代码示例>>C++>>正文


C++ quantity类代码示例

本文整理汇总了C++中quantity的典型用法代码示例。如果您正苦于以下问题:C++ quantity类的具体用法?C++ quantity怎么用?C++ quantity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了quantity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: cartesianVelocityToWheelVelocities

///Calculates from the cartesian velocity the individual wheel velocities
///@param longitudinalVelocity is the forward or backward velocity
///@param transversalVelocity is the sideway velocity
///@param angularVelocity is the rotational velocity around the center of the YouBot
///@param wheelVelocities are the individual wheel velocities
void FourSwedishWheelOmniBaseKinematic::cartesianVelocityToWheelVelocities(const quantity<si::velocity>& longitudinalVelocity, const quantity<si::velocity>& transversalVelocity, const quantity<si::angular_velocity>& angularVelocity, std::vector<quantity<angular_velocity> >& wheelVelocities) {
    // Bouml preserved body begin 0004C071
    quantity<angular_velocity> RadPerSec_FromX;
    quantity<angular_velocity> RadPerSec_FromY;
    quantity<angular_velocity> RadPerSec_FromTheta;
    wheelVelocities.assign(4, RadPerSec_FromX);

    if (config.wheelRadius.value() == 0 || config.rotationRatio == 0 || config.slideRatio == 0) {
        throw std::out_of_range("The wheelRadius, RotationRatio or the SlideRatio are not allowed to be zero");
    }

    // RadPerSec_FromX = longitudinalVelocity / config.wheelRadius;
    RadPerSec_FromX = longitudinalVelocity.value() / config.wheelRadius.value() * radian_per_second;
    RadPerSec_FromY = transversalVelocity.value() / (config.wheelRadius.value() * config.slideRatio) * radian_per_second;

    // Calculate Rotation Component
    RadPerSec_FromTheta = ((config.lengthBetweenFrontAndRearWheels + config.lengthBetweenFrontWheels) / (2.0 * config.wheelRadius)) * angularVelocity;

    wheelVelocities[0] = -RadPerSec_FromX + RadPerSec_FromY + RadPerSec_FromTheta;
    wheelVelocities[1] = RadPerSec_FromX + RadPerSec_FromY + RadPerSec_FromTheta;
    wheelVelocities[2] = -RadPerSec_FromX - RadPerSec_FromY + RadPerSec_FromTheta;
    wheelVelocities[3] = RadPerSec_FromX - RadPerSec_FromY + RadPerSec_FromTheta;

    return;

    // Bouml preserved body end 0004C071
}
开发者ID:praman2s,项目名称:youbot_driver,代码行数:32,代码来源:FourSwedishWheelOmniBaseKinematic.cpp

示例2: cartesianPositionToWheelPositions

///Calculates from the cartesian position the wheel positions
///@param longitudinalPosition is the forward or backward position
///@param transversalPosition is the sideway position
///@param orientation is the rotation around the center
///@param wheelPositions are the individual positions of the wheels
void FourSwedishWheelOmniBaseKinematic::cartesianPositionToWheelPositions(const quantity<si::length>& longitudinalPosition, const quantity<si::length>& transversalPosition, const quantity<plane_angle>& orientation, std::vector<quantity<plane_angle> >& wheelPositions) {
    // Bouml preserved body begin 000C08F1

    quantity<plane_angle> Rad_FromX;
    quantity<plane_angle> Rad_FromY;
    quantity<plane_angle> Rad_FromTheta;
    wheelPositions.assign(4, Rad_FromX);

    if (config.wheelRadius.value() == 0 || config.rotationRatio == 0 || config.slideRatio == 0) {
        throw std::out_of_range("The wheelRadius, RotationRatio or the SlideRatio are not allowed to be zero");
    }

    // RadPerSec_FromX = longitudinalVelocity / config.wheelRadius;
    Rad_FromX = longitudinalPosition.value() / config.wheelRadius.value() * radian;
    Rad_FromY = transversalPosition.value() / (config.wheelRadius.value() * config.slideRatio) * radian;

    // Calculate Rotation Component
    Rad_FromTheta = ((config.lengthBetweenFrontAndRearWheels + config.lengthBetweenFrontWheels) / (2.0 * config.wheelRadius)) * orientation;

    wheelPositions[0] = -Rad_FromX + Rad_FromY + Rad_FromTheta;
    wheelPositions[1] = Rad_FromX + Rad_FromY + Rad_FromTheta;
    wheelPositions[2] = -Rad_FromX - Rad_FromY + Rad_FromTheta;
    wheelPositions[3] = Rad_FromX - Rad_FromY + Rad_FromTheta;

    return;

    // Bouml preserved body end 000C08F1
}
开发者ID:praman2s,项目名称:youbot_driver,代码行数:33,代码来源:FourSwedishWheelOmniBaseKinematic.cpp

示例3: BOOST_PREVENT_MACRO_SUBSTITUTION

inline 
bool 
isless BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
                                         const quantity<Unit,Y>& q2)
{ 
    using namespace detail;
    return isless BOOST_PREVENT_MACRO_SUBSTITUTION (q1.value(),q2.value());
}
开发者ID:TheForum,项目名称:Earth-and-Beyond-server,代码行数:8,代码来源:cmath_boost_1_35.hpp

示例4:

quantity<R1, R2>
operator-(const quantity<R1, R2>& x, const quantity<R1, R2>& y)
{
    typedef quantity<R1, R2> R;
    R r;
    r.set(x.get() - y.get());
    return r;
}
开发者ID:LancelotGHX,项目名称:Simula,代码行数:8,代码来源:si_physics.cpp

示例5: size

ScaledProjection::ScaledProjection( 
        ImagePosition size,
        quantity<camera::resolution> x, 
        quantity<camera::resolution> y )
: size(size),
  to_sample( 1.0 / x.value() , 1.0 / y.value() ),
  to_image( to_sample.inverse() )
{
}
开发者ID:stevewolter,项目名称:rapidSTORM,代码行数:9,代码来源:ScaledProjection.cpp

示例6: fmod

inline
quantity<Unit, Y>
fmod(const quantity<Unit,Y>& q1, const quantity<Unit,Y>& q2)
{
    using std::fmod;
    
    typedef quantity<Unit,Y> quantity_type;

    return quantity_type::from_value(fmod(q1.value(), q2.value()));
}
开发者ID:TheForum,项目名称:Earth-and-Beyond-server,代码行数:10,代码来源:cmath_boost_1_35.hpp

示例7: pow

inline
quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y>
pow(const quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y>& q1,
    const quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y>& q2)
{
    using std::pow;

    typedef quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S),Y> quantity_type;

    return quantity_type::from_value(pow(q1.value(), q2.value()));
}
开发者ID:TheForum,项目名称:Earth-and-Beyond-server,代码行数:11,代码来源:cmath_boost_1_35.hpp

示例8: ldexp

inline
quantity<Unit, Y>
ldexp(const quantity<Unit, Y>& q,const Int& ex)
{
    using std::ldexp;

    typedef quantity<Unit,Y> quantity_type;

    return quantity_type::from_value(ldexp(q.value(), ex));
}
开发者ID:TheForum,项目名称:Earth-and-Beyond-server,代码行数:10,代码来源:cmath_boost_1_35.hpp

示例9: frexp

inline
quantity<Unit, Y>
frexp(const quantity<Unit, Y>& q,Int* ex)
{
    using std::frexp;

    typedef quantity<Unit,Y> quantity_type;

    return quantity_type::from_value(frexp(q.value(),ex));
}
开发者ID:TheForum,项目名称:Earth-and-Beyond-server,代码行数:10,代码来源:cmath_boost_1_35.hpp

示例10: log10

inline
quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y>
log10(const quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y>& q)
{
    using std::log10;

    typedef quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y> quantity_type;

    return quantity_type::from_value(log10(q.value()));
}
开发者ID:TheForum,项目名称:Earth-and-Beyond-server,代码行数:10,代码来源:cmath_boost_1_35.hpp

示例11: modf

inline
quantity<Unit, Y>
modf(const quantity<Unit, Y>& q1, quantity<Unit, Y>* q2)
{
    using std::modf;

    typedef quantity<Unit,Y> quantity_type;

    return quantity_type::from_value(modf(q1.value(), &quantity_cast<Y&>(*q2)));
}
开发者ID:TheForum,项目名称:Earth-and-Beyond-server,代码行数:10,代码来源:cmath_boost_1_35.hpp

示例12: sqrt

inline 
typename root_typeof_helper<
                            quantity<Unit,Y>,
                            static_rational<2>
                           >::type
sqrt(const quantity<Unit,Y>& q)
{
    using std::sqrt;

    typedef typename root_typeof_helper<
                                        quantity<Unit,Y>,
                                        static_rational<2>
                                       >::type quantity_type;

    return quantity_type::from_value(sqrt(q.value()));
}
开发者ID:TheForum,项目名称:Earth-and-Beyond-server,代码行数:16,代码来源:cmath_boost_1_35.hpp

示例13: convert

 static quantity<s2::length,Y> convert(const quantity<s1::length,X>& source)
 {
     return quantity<s2::length,Y>::from_value(2.5*source.value());
 }
开发者ID:jiayuehua,项目名称:hello-panda-project,代码行数:4,代码来源:tutorial.cpp

示例14:

inline bool operator==(quantity<Unit, Value> const& q, zero_t) {
  return q.value() == 0.0;
}
开发者ID:jbytheway,项目名称:fearless,代码行数:3,代码来源:zero.hpp

示例15: accelerate

void AutoNavigator::accelerate(quantity<si::velocity, f32> targetSpeed)
{
	mAccelerationFactor = targetSpeed.value() / mMaxSpeed.value();
}
开发者ID:wangxun159123,项目名称:Brute-Force-Game-Engine,代码行数:4,代码来源:AutoNavigator.cpp


注:本文中的quantity类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。