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


C++ Vector6d::segment方法代码示例

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


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

示例1: mapCartesian

/*!
 * This function is implemented in order to not use any external
 * mapping functions. The function was build completely from pieces of
 * code of the old cartesianStateDerivativeModel in order to use
 * completely different, but also verified methods of constructing a
 * stateDerivative from the total accelerations.
 * \param currentState The current state.
 * \param accelerations Total sum of accelerations.
 * \return stateDerivative
 */
Vector6d mapCartesian( const Vector6d& cartesianState, const Eigen::Vector3d& acceleration )
{
    
    // {{{ Snippets from cartesianStateDerivativeModel.h
    typedef Vector6d CartesianStateDerivativeType;

    // Declare Cartesian state derivative size.
    unsigned int stateDerivativeSize = cartesianState.rows( );

    // Declare Cartesian state derivative of the same size as Cartesian state.
    CartesianStateDerivativeType cartesianStateDerivative
	= CartesianStateDerivativeType::Zero( stateDerivativeSize );

    // Set derivative of position components to current Cartesian velocity.
    cartesianStateDerivative.segment( 0, stateDerivativeSize / 2 )
	= cartesianState.segment( stateDerivativeSize / 2, stateDerivativeSize / 2 );

    // Add transformed acceleration to state derivative.
    cartesianStateDerivative.segment( stateDerivativeSize / 2, stateDerivativeSize / 2 )
	+= acceleration;

    // Return assembled state derivative.
    return cartesianStateDerivative;

    // }}} End Snippets from cartesianStateDerivativeModel.h
}
开发者ID:Haider-BA,项目名称:tudat,代码行数:36,代码来源:unitTestOrbitalStateDerivativeModel.cpp

示例2: determinePartCoefficients

//! Determine aerodynamic coefficients of a single vehicle part.
Vector6d HypersonicLocalInclinationAnalysis::determinePartCoefficients(
        const int partNumber, const boost::array< int, 3 > independentVariableIndices )
{
    // Declare and determine angles of attack and sideslip for analysis.
    double angleOfAttack =  dataPointsOfIndependentVariables_[ 1 ]
            [ independentVariableIndices[ 1 ] ];

    double angleOfSideslip =  dataPointsOfIndependentVariables_[ 2 ]
            [ independentVariableIndices[ 2 ] ];

    // Declare partCoefficient vector.
    Vector6d partCoefficients = Vector6d::Zero( );

    // Check whether the inclinations of the vehicle part have already been computed.
    if ( previouslyComputedInclinations_.count( std::pair< double, double >(
                                                    angleOfAttack, angleOfSideslip ) ) == 0 )
    {
        // Determine panel inclinations for part.
        determineInclinations( angleOfAttack, angleOfSideslip );

        // Add panel inclinations to container
        previouslyComputedInclinations_[ std::pair< double, double >(
                    angleOfAttack, angleOfSideslip ) ] = inclination_;
    }

    else
    {
        // Fetch inclinations from container
        inclination_ = previouslyComputedInclinations_[ std::pair< double, double >(
                    angleOfAttack, angleOfSideslip ) ];
    }

    // Set pressureCoefficient_ array for given independent variables.
    determinePressureCoefficients( partNumber, independentVariableIndices );

    // Calculate force coefficients from pressure coefficients.
    partCoefficients.segment( 0, 3 ) = calculateForceCoefficients( partNumber );

    // Calculate moment coefficients from pressure coefficients.
    partCoefficients.segment( 3, 3 ) = calculateMomentCoefficients( partNumber );

    return partCoefficients;
}
开发者ID:JPelamatti,项目名称:TudatDevelopment,代码行数:44,代码来源:hypersonicLocalInclinationAnalysis.cpp


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