<commit_before>#include "chrono/physics/ChBodyEasy.h"
#include "chrono/physics/ChLinkTrajectory.h"

#include "chrono_irrlicht/ChIrrApp.h"

#include "chrono_vehicle/tracked_vehicle/utils/ChSprocketProfiles.h"

using namespace chrono;
using namespace geometry;

using namespace irr;

using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;

int main(int argc, char* argv[]) {
    ChSystem system;

    ChIrrApp application(&system, L"Paths", core::dimension2d<u32>(800, 600), false, true);
    application.AddTypicalLogo();
    application.AddTypicalSky();
    application.AddTypicalLights();
    application.AddTypicalCamera(core::vector3df(0.5, 0.5, -1));

    // Show contact forces in Irrlicht application
    application.SetSymbolscale(0.2);
    application.SetContactsDrawMode(ChIrrTools::eCh_ContactsDrawMode::CONTACT_NORMALS);

    // ----------------------
    // Create the ground body
    // ----------------------

    ChSharedPtr<ChBody> ground(new ChBody());
    ground->SetIdentifier(-1);
    ground->SetBodyFixed(true);
    application.GetSystem()->AddBody(ground);

    // -----------------------------
    // Create the rotating gear body
    // -----------------------------

    ChVector<> gear_loc(0, 0, 0);

    ChSharedPtr<ChBody> gear(new ChBody());
    gear->SetIdentifier(0);
    gear->SetPos(gear_loc);
    //gear->SetWvel_loc(ChVector<>(0, 0, 0.1));
    application.GetSystem()->AddBody(gear);

    int n_teeth = 10;
    double R_T = 0.2605;
    double R_C = 0.3;
    double R = 0.089;
    double separation = 0.25;

    ChSharedPtr<ChLinePath> gear_profile = vehicle::ChCircularProfile(n_teeth, R_T, R_C, R);

    // Add the collision shape to gear
    gear->GetCollisionModel()->SetSafeMargin(0.02);
    gear->SetCollide(true);
    gear->GetCollisionModel()->ClearModel();
    gear->GetCollisionModel()->Add2Dpath(*gear_profile.get_ptr(), ChVector<>(0, 0, separation / 2));
    gear->GetCollisionModel()->Add2Dpath(*gear_profile.get_ptr(), ChVector<>(0, 0, -separation / 2));
    gear->GetCollisionModel()->BuildModel();<commit_msg>Remove dependency of test_profile on obsolete functions<commit_after>#include "chrono/core/ChShared.h"
#include "chrono/physics/ChSystem.h"
#include "chrono/physics/ChBody.h"

#include "chrono/geometry/ChCLinePath.h"
#include "chrono/geometry/ChCLineSegment.h"
#include "chrono/geometry/ChCLineArc.h"

#include "chrono_irrlicht/ChIrrApp.h"

using namespace chrono;
using namespace geometry;

using namespace irr;

using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;

// -----------------------------------------------------------------------------
ChSharedPtr<geometry::ChLinePath> CreateProfile(int num_teeth, double R_T, double R_C, double R)
{
    ChSharedPtr<geometry::ChLinePath> profile(new geometry::ChLinePath);

    double beta = CH_C_2PI / num_teeth;
    double sbeta = std::sin(beta / 2);
    double cbeta = std::cos(beta / 2);
    double y = (R_T * R_T + R_C * R_C - R * R) / (2 * R_C);
    double x = std::sqrt(R_T * R_T - y * y);
    double gamma = std::asin(x / R);

    for (int i = 0; i < num_teeth; ++i) {
        double alpha = -i * beta;
        ChVector<> p0(0, R_C, 0);
        ChVector<> p1(-R_T * sbeta, R_T * cbeta, 0);
        ChVector<> p2(-x, y, 0);
        ChVector<> p3(x, y, 0);
        ChVector<> p4(R_T * sbeta, R_T * cbeta, 0);
        ChQuaternion<> quat;
        quat.Q_from_AngZ(alpha);
        ChMatrix33<> rot(quat);
        p0 = rot * p0;
        p1 = rot * p1;
        p2 = rot * p2;
        p3 = rot * p3;
        p4 = rot * p4;
        geometry::ChLineSegment seg1(p1, p2);
        double angle1 = alpha + 1.5 * CH_C_PI - gamma;
        double angle2 = alpha + 1.5 * CH_C_PI + gamma;
        geometry::ChLineArc arc(ChCoordsys<>(p0), R, angle1, angle2, true);
        geometry::ChLineSegment seg2(p3, p4);
        profile->AddSubLine(seg1);
        profile->AddSubLine(arc);
        profile->AddSubLine(seg2);
    }

    return profile;
}

// -----------------------------------------------------------------------------
int main(int argc, char* argv[]) {
    ChSystem system;

    ChIrrApp application(&system, L"Paths", core::dimension2d<u32>(800, 600), false, true);
    application.AddTypicalLogo();
    application.AddTypicalSky();
    application.AddTypicalLights();
    application.AddTypicalCamera(core::vector3df(0.5, 0.5, -1));

    // Show contact forces in Irrlicht application
    application.SetSymbolscale(0.2);
    application.SetContactsDrawMode(ChIrrTools::eCh_ContactsDrawMode::CONTACT_NORMALS);

    // ----------------------
    // Create the ground body
    // ----------------------

    ChSharedPtr<ChBody> ground(new ChBody());
    ground->SetIdentifier(-1);
    ground->SetBodyFixed(true);
    application.GetSystem()->AddBody(ground);

    // -----------------------------
    // Create the rotating gear body
    // -----------------------------

    ChVector<> gear_loc(0, 0, 0);

    ChSharedPtr<ChBody> gear(new ChBody());
    gear->SetIdentifier(0);
    gear->SetPos(gear_loc);
    //gear->SetWvel_loc(ChVector<>(0, 0, 0.1));
    application.GetSystem()->AddBody(gear);

    int n_teeth = 10;
    double R_T = 0.2605;
    double R_C = 0.3;
    double R = 0.089;
    double separation = 0.25;

    ChSharedPtr<ChLinePath> gear_profile = CreateProfile(n_teeth, R_T, R_C, R);

    // Add the collision shape to gear
    gear->GetCollisionModel()->SetSafeMargin(0.02);
    gear->SetCollide(true);
    gear->GetCollisionModel()->ClearModel();
    gear->GetCollisionModel()->Add2Dpath(*gear_profile.get_ptr(), ChVector<>(0, 0, separation / 2));
    gear->GetCollisionModel()->Add2Dpath(*gear_profile.get_ptr(), ChVector<>(0, 0, -separation / 2));
    gear->GetCollisionModel()->BuildModel();
{'fraction_non_alphanumeric': 0.19759862778730702, 'fraction_numerical': 0.02590051457975986, 'mean_word_length': 2.690506329113924, 'pattern_counts': {'":': 0, '<': 30, '<?xml version=': 0, '>': 68, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5516130', 'n_tokens_mistral': 2005, 'n_tokens_neox': 1931, 'n_words': 397}