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


C++ Force类代码示例

本文整理汇总了C++中Force的典型用法代码示例。如果您正苦于以下问题:C++ Force类的具体用法?C++ Force怎么用?C++ Force使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: applyForces

 void ParticleSystem::applyForces()
 {
     if ( gravity.length() > 0.0f )
     {
         for ( int i = 0; i < mParticles.size(); ++i )
         {
             Particle* p = mParticles[i];
             p->mAcc += gravity;
         }
     }
     
     for ( int i = 0; i < mParticles.size(); ++i )
     {
         Particle* p = mParticles[i];
         p->mAcc -= p->mVel * drag;
     }
     
     for ( int i = 0; i < mSprings.size(); i++ )
     {
         Spring* f = mSprings[i];
         f->apply();
     }
     
     for ( int i = 0; i < attractions.size(); i++ )
     {
         Attraction* f = attractions[i];
         f->apply();
     }
     
     for ( int i = 0; i < customForces.size(); i++ )
     {
         Force* f = customForces[i];
         f->apply();
     }
 }
开发者ID:AlanChatham,项目名称:Eyeo2012,代码行数:35,代码来源:ParticleSystem.cpp

示例2: TotalForceLength

float RuntimeObject::TotalForceLength() const {
  Force ForceMoyenne;
  ForceMoyenne.SetX(TotalForceX());
  ForceMoyenne.SetY(TotalForceY());

  return ForceMoyenne.GetLength();
}
开发者ID:Lizard-13,项目名称:GD,代码行数:7,代码来源:RuntimeObject.cpp

示例3: getForce

sf::Vector3f Force::produitVectoriel(Force vect)
{
    sf::Vector3f vect3d;
    vect3d.x = 0;
    vect3d.y = 0;
    vect3d.z = getForce().x*vect.getForce().y-getForce().y*vect.getForce().x;
    return vect3d;
}
开发者ID:WeHaveCookie,项目名称:Kirby-Fever,代码行数:8,代码来源:Force.cpp

示例4: SetCollide

S_Chicken::S_Chicken( )
{
	AABox* aabox = new AABox;
	aabox->SetSize( CHICKEN_WIDTH_DEPTH, CHICKEN_HEIGHT, CHICKEN_WIDTH_DEPTH );
	SetCollide( aabox );

	Force* force = new Force;
	force->SetMaxVelocity( 3.0f );
	SetMoveForce( force );
}
开发者ID:smcbeth,项目名称:Example,代码行数:10,代码来源:s_chicken.cpp

示例5: updateDisplayer

void OpenSimContext::updateDisplayer(Force& f) {
  // If muscle or force acting along a path then call respective updateDisplayer otherwise do nothing for now
  realizeVelocity();
  if (dynamic_cast<Muscle*>(&f)!= NULL)
    return dynamic_cast<Muscle*>(&f)->updateDisplayer(*_configState);
  if (f.hasGeometryPath()){
    AbstractProperty& pathProp = f.updPropertyByName("GeometryPath");
    Object& pathObj = pathProp.updValueAsObject();
    return dynamic_cast<GeometryPath*>(&pathObj)->updateDisplayer(*_configState);
  }
  if (f.getDisplayer()!= NULL)
    f.updateDisplayer(*_configState);
}
开发者ID:mjhmilla,项目名称:opensim-core,代码行数:13,代码来源:OpenSimContext.cpp

示例6: calculateNewPosition

	void calculateNewPosition(double delta_t) {
		Force resultant = getResultantForce();
//		cout << "Resultant Force " << resultant.getDir().getX() << " " << resultant.getDir().getY() << endl;
		
		Vec2D accel(resultant.getX() / _mass, resultant.getY() / _mass);
//		cout << "Acceleration " << accel.getX() << " " << accel.getY() << endl;
		Vec2D newPos = _pos + _vel * delta_t;
		Vec2D newVel = _vel + accel * delta_t;
//		cout << "Position " << newPos.getX() << " " << newPos.getY() << endl;
//		cout << "Velocity " << newVel.getX() << " " << newVel.getY() << endl;
		setPos(newPos);
		setVel(newVel);
	}
开发者ID:zeeshanabid94,项目名称:Barnes-Hut-N-Body-Simulation,代码行数:13,代码来源:body.cpp

示例7: adoptForce

 ForceIndex adoptForce(Force& force) {
     invalidateSubsystemTopologyCache();
     const ForceIndex index((int) forces.size());
     forces.push_back(new Force()); // grow
     Force& f = *forces.back(); // refer to the empty handle we just created
     force.disown(f); // transfer ownership to f
     return index;
 }
开发者ID:BrianZ1,项目名称:simbody,代码行数:8,代码来源:GeneralForceSubsystem.cpp

示例8: options

int ImbalanceGroup::options(int narg, char **arg)
{
  Error *error = _lmp->error;
  Force *force = _lmp->force;
  Group *group = _lmp->group;

  if (narg < 3) error->all(FLERR,"Illegal balance weight command");

  _num = force->inumeric(FLERR,arg[0]);
  if (_num < 1) error->all(FLERR,"Illegal balance weight command");
  if (2*_num+1 > narg) error->all(FLERR,"Illegal balance weight command");

  _id = new int[_num];
  _factor = new double[_num];
  for (int i = 0; i < _num; ++i) {
    _id[i] = group->find(arg[2*i+1]);
    if (_id[i] < 0)
      error->all(FLERR,"Unknown group in balance weight command");
    _factor[i] = force->numeric(FLERR,arg[2*i+2]);
  }
  return 2*_num+1;
}
开发者ID:ibethune,项目名称:lammps,代码行数:22,代码来源:imbalance_group.cpp

示例9: irr_simd_firr

static void irr_simd_firr(
		const int addr,
		_out_ double accout[3],
		_out_ double jrkout[3],
        _out_ int    &nnbid)
{
	const Particle *ptcl = ::ptcl;
	const v2df      tnow = ::vec_tnow;
	const int  nnb  = list[addr].nnb;

	Force force;
	force.clear();

	const Pred4 pri(Predictor(ptcl[addr], tnow));

	for(int k=0; k<nnb; k++){
		const int jaddr = list[addr].nb[k];
		ptcl[jaddr].prefetch();
	}

	for(int k=0; k<nnb; k+=4){
		const int *jptr = &(list[addr].nb[k]);
		const Predictor p0(ptcl[jptr[0]], tnow);
		const Predictor p1(ptcl[jptr[1]], tnow);
		const Predictor p2(ptcl[jptr[2]], tnow);
		const Predictor p3(ptcl[jptr[3]], tnow);

		const Pred4 prj(p0, p1, p2, p3);

        assert(0 == (size_t)jptr % 16);
        v4sf idx = *(v4sf *)jptr;
        force.calc_and_accum(pri, prj, idx);
	}

	force.write(accout, jrkout, nnbid);
}
开发者ID:nbodyx,项目名称:Nbody6ppGPU,代码行数:36,代码来源:irr.sse.cpp

示例10: CalcReaction

void GroupT::CalcReaction()
{

double SumFx=0;
double SumFy=0;
double SumTorque=0;

for (list<Force *>::iterator f = s1->forces.begin(); f!=s1->forces.end(); f++)
    {
        Force  *x = *f;
        if(x->IsCalculatedx())
            SumFx+=x->GetForcex();
        if(x->IsCalculatedy())
            SumFy+=x->GetForcey();
        if(x->IsCalculatedt())
            SumTorque+=x->GetForcet();
    }

O->R1->SetForce(-SumFx,-SumFy,0);
O->R2->SetForce(SumFx,SumFy,0);

}
开发者ID:just-another-one-timmy,项目名称:mechanism-cpp,代码行数:22,代码来源:GroupT.cpp

示例11: getAngular

 static Vector3 getAngular(const Force & self) { return self.angular(); }
开发者ID:nim65s,项目名称:pinocchio,代码行数:1,代码来源:force.hpp

示例12: setLinear

 static void setLinear(Force & self, const Vector3 & f) { self.linear(f); }
开发者ID:nim65s,项目名称:pinocchio,代码行数:1,代码来源:force.hpp

示例13: getLinear

 static Vector3 getLinear(const Force & self ) { return self.linear(); }
开发者ID:nim65s,项目名称:pinocchio,代码行数:1,代码来源:force.hpp

示例14: getinitargs

 static
 boost::python::tuple
 getinitargs(const Force & f)
 { return bp::make_tuple((Vector3)f.linear(),(Vector3)f.angular()); }
开发者ID:nim65s,项目名称:pinocchio,代码行数:4,代码来源:force.hpp

示例15:

 	const Eigen::Matrix<double, 1, 1>
 	operator*( const Force& f ) const
 	{
 	  return ref.axis.transpose()*f.angular();
 	}
开发者ID:MaximilienNaveau,项目名称:pinocchio,代码行数:5,代码来源:joint-revolute-unaligned.hpp


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