本文整理汇总了C++中ChSharedPtr::GetMaterialSurface方法的典型用法代码示例。如果您正苦于以下问题:C++ ChSharedPtr::GetMaterialSurface方法的具体用法?C++ ChSharedPtr::GetMaterialSurface怎么用?C++ ChSharedPtr::GetMaterialSurface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ChSharedPtr
的用法示例。
在下文中一共展示了ChSharedPtr::GetMaterialSurface方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create_items
void create_items(ChIrrAppInterface& application)
{
// Create some spheres in a vertical stack
bool do_wall = false;
bool do_stack = true;
bool do_oddmass = true;
bool do_spheres = true;
bool do_heavyonside = true;
double sphrad = 0.2;
double dens= 1000;
double sphmass = dens * (4./3.) * CH_C_PI * pow(sphrad,3);
double sphinertia = (2./5.) * sphmass * pow(sphrad,2);
if (do_stack)
{
int nbodies = 15;
double totmass= 0;
double level = 0;
double sphrad_base = 0.2;
double oddfactor = 100;
for (int bi = 0; bi < nbodies; bi++) // N. of vert. bricks
{
double sphrad = sphrad_base;
if (do_oddmass && bi==(nbodies-1))
sphrad = sphrad*pow(oddfactor, 1./3.);
double dens= 1000;
ChSharedPtr<ChBody> mrigidBody;
if (do_spheres)
{
mrigidBody = ChSharedPtr<ChBodyEasySphere>(new ChBodyEasySphere(
sphrad, // radius
dens, // density
true, // collide enable?
true)); // visualization?
mrigidBody->SetPos(ChVector<>(0.5, sphrad+level, 0.7));
mrigidBody->AddAsset(ChSharedPtr<ChTexture>(new ChTexture(GetChronoDataFile("bluwhite.png"))));
application.GetSystem()->Add(mrigidBody);
}
else
{
mrigidBody = ChSharedPtr<ChBodyEasyBox>(new ChBodyEasyBox(
sphrad,sphrad,sphrad, // x,y,z size
dens, // density
true, // collide enable?
true)); // visualization?
mrigidBody->SetPos(ChVector<>(0.5, sphrad+level, 0.7));
mrigidBody->AddAsset(ChSharedPtr<ChTexture>(new ChTexture(GetChronoDataFile("cubetexture_bluwhite.png"))));
application.GetSystem()->Add(mrigidBody);
}
mrigidBody->GetMaterialSurface()->SetFriction(0.5f);
mrigidBody->GetMaterialSurface()->SetRestitution(0.0f);
mspheres.push_back(mrigidBody);
level +=sphrad*2;
totmass +=mrigidBody->GetMass();
}
GetLog() << "Expected contact force at bottom F=" << (totmass *application.GetSystem()->Get_G_acc().y) << "\n";
}
if (do_wall)
for (int ai = 0; ai < 1; ai++) // N. of walls
{
for (int bi = 0; bi < 10; bi++) // N. of vert. bricks
{
for (int ui = 0; ui < 15; ui++) // N. of hor. bricks
{
ChSharedPtr<ChBodyEasyBox> mrigidWall (new ChBodyEasyBox(
3.96,2,4, // radius
dens, // density
true, // collide enable?
true)); // visualization?
mrigidWall->SetPos(ChVector<>(-8+ui*4.0+2*(bi%2), 1.0+bi*2.0, -5+ ai*6));
mrigidWall->GetMaterialSurface()->SetFriction(0.4f);
mrigidWall->AddAsset(ChSharedPtr<ChTexture>(new ChTexture(GetChronoDataFile("cubetexture_bluwhite.png"))));
application.GetSystem()->Add(mrigidWall);
}
}
}
if (do_heavyonside)
{
double sphrad = 0.2;
double dens= 1000;
double hfactor = 100;
ChSharedPtr<ChBodyEasySphere> mrigidHeavy(new ChBodyEasySphere(
sphrad, // radius
//.........这里部分代码省略.........