uraeus/nmbd/cpp/engine/src/uraeus/numerics/geometries.cpp
// cylinder geometry function returning a geometry object
// ------------------------------------------------------
cylinder geometry function returning a geometry object
cylinder geometry function returning a geometry object
geometry cylinder_geometry(Eigen::Vector3d& p1, Eigen::Vector3d& p2, double& ro, double ri)
{   
    geometry geo;
    Eigen::Vector3d axis = p2 - p1 ;
    auto frame = triad(axis);
    const double length = axis.norm();
    const double density = 7.9*1e-3;
    const double vol = (22./7) * (std::pow(ro, 2) - std::pow(ri, 2)) * length;
    double m = density * vol ;
    const double Jzz = (m/2) * (std::pow(ro, 2) + std::pow(ri, 2));
    const double Jyy = (m/12) * (3 * (std::pow(ro, 2) + std::pow(ri, 2)) + std::pow(length, 2));
    const double Jxx = Jyy ;
    Eigen::Vector4d P = A2P(frame);
    Eigen::DiagonalMatrix<double, 3> J(Jxx, Jyy, Jzz);
    geo.J = A(P) * J * A(P).transpose() ;
    geo.P << 1, 0, 0, 0 ;
    geo.R = centered({p1, p2});
    geo.m = m ;
    return geo;
}
geometry cylinder_geometry ( Eigen :: Vector3d & p1 , Eigen :: Vector3d & p2 , double & ro , double ri ) { geometry geo ; Eigen :: Vector3d axis = p2 - p1 ; auto frame = triad ( axis ) ; const double length = axis . norm ( ) ; const double density = 7.9 * 1e-3 ; const double vol = ( 22. / 7 ) * ( std :: pow ( ro , 2 ) - std :: pow ( ri , 2 ) ) * length ; double m = density * vol ; const double Jzz = ( m / 2 ) * ( std :: pow ( ro , 2 ) + std :: pow ( ri , 2 ) ) ; const double Jyy = ( m / 12 ) * ( 3 * ( std :: pow ( ro , 2 ) + std :: pow ( ri , 2 ) ) + std :: pow ( length , 2 ) ) ; const double Jxx = Jyy ; Eigen :: Vector4d P = A2P ( frame ) ; Eigen :: DiagonalMatrix < double , 3 > J ( Jxx , Jyy , Jzz ) ; geo . J = A ( P ) * J * A ( P ) . transpose ( ) ; geo . P << 1 , 0 , 0 , 0 ; geo . R = centered ( { p1 , p2 } ) ; geo . m = m ; return geo ; }
cylinder geometry function returning a geometry object
cylinder geometry function returning a geometry object