uraeus/nmbd/cpp/engine/src/uraeus/numerics/geometries.cpp
// composite_geometry geometry function returning a geometry object
// ----------------------------------------------------------------
composite_geometry geometry function returning a geometry object
composite_geometry geometry function returning a geometry object
geometry composite_geometry(std::vector<geometry>& geometries)
{
    geometry geo;
    auto& m = geo.m;
    auto& R = geo.R;
    auto& J = geo.J;
    const auto& I = Eigen::MatrixXd::Identity(3, 3);
    for (const auto& g : geometries) {m += g.m;};
    for (const auto& g : geometries)
    { 
        R += (1/m) * (g.m * g.R);
    };
    for (const auto& g : geometries)
    {
        auto d = g.R - R;
        J += (
                A(g.P) * (g.J) * (A(g.P).transpose())
              + g.m * (d.squaredNorm()*I - d*d.transpose())
             );
    };
    geo.P << 1, 0, 0, 0;
    return geo;
}
geometry composite_geometry ( std :: vector < geometry > & geometries ) { geometry geo ; auto & m = geo . m ; auto & R = geo . R ; auto & J = geo . J ; const auto & I = Eigen :: MatrixXd :: Identity ( 3 , 3 ) ; for ( const auto & g : geometries ) { m += g . m ; } ; for ( const auto & g : geometries ) { R += ( 1 / m ) * ( g . m * g . R ) ; } ; for ( const auto & g : geometries ) { auto d = g . R - R ; J += ( A ( g . P ) * ( g . J ) * ( A ( g . P ) . transpose ( ) ) + g . m * ( d . squaredNorm ( ) * I - d * d . transpose ( ) ) ) ; } ; geo . P << 1 , 0 , 0 , 0 ; return geo ; }
composite_geometry geometry function returning a geometry object
composite_geometry geometry function returning a geometry object
// composite body total mass as the sum of it's subcomponents //std::cout << "Geometry mass = " << m << std::endl; // center of mass vector relative to the origin //std::cout << "R = " << R << std::endl; //std::cout << "Geometry R = " << R << std::endl;