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


C++ Force::GetForcet方法代码示例

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


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

示例1: 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

示例2: CalcReaction

void GroupTTT::CalcReaction()
{

double SumTorque1=0;

for (list<Force *>::iterator f = s1->forces.begin(); f!=s1->forces.end(); f++)
    {
        Force  *Fi = *f;
        double T=0;
        double Fx=0;
        double Fy=0;
        if(Fi->IsCalculatedt())
            T=Fi->GetForcet();
        if(Fi->IsCalculatedx())
            Fx=Fi->GetForcex();
        if(Fi->IsCalculatedy())
            Fy=Fi->GetForcey();

        double leverx = -Fi->linear->x.GetTF0()+A->linear.x.GetTF0();
        double levery = -Fi->linear->y.GetTF0()+A->linear.y.GetTF0();

        SumTorque1+=T+Fx*leverx-Fy*levery;
    }

double SumTorque2=0;

/*
   dd:=(yb[i]-ya[i])*(xb[i]-xc[i])+(yb[i]-yc[i])*(xa[i]-xb[i]);
        dd1:=-k3*(xb[i]-xc[i])+k4*(xa[i]-xb[i]);
        dd2:=k4*(ya[i]-yb[i])+k3*(yb[i]-yc[i]);

*/

for (list<Force *>::iterator f = s2->forces.begin(); f!=s2->forces.end(); f++)
    {
        Force  *Fi = *f;
        double T=0;
        double Fx=0;
        double Fy=0;
        if(Fi->IsCalculatedt())
            T=Fi->GetForcet();
        if(Fi->IsCalculatedx())
            Fx=Fi->GetForcex();
        if(Fi->IsCalculatedy())
            Fy=Fi->GetForcey();
        double leverx = -Fi->linear->x.GetTF0()+C->linear.x.GetTF0();
        double levery = -Fi->linear->y.GetTF0()+C->linear.y.GetTF0();


            SumTorque2+=T+Fx*leverx-Fy*levery;
    }

/*
   dd:=(yb[i]-ya[i])*(xb[i]-xc[i])+(yb[i]-yc[i])*(xa[i]-xb[i]);
        dd1:=-k3*(xb[i]-xc[i])+k4*(xa[i]-xb[i]);
        dd2:=k4*(ya[i]-yb[i])+k3*(yb[i]-yc[i]);

*/

double leverxAB = A->linear.x.GetTF0()-B->linear.x.GetTF0();
double leveryAB = A->linear.y.GetTF0()-B->linear.y.GetTF0();

double leverxCB = C->linear.x.GetTF0()-B->linear.x.GetTF0();
double leveryCB = C->linear.y.GetTF0()-B->linear.y.GetTF0();

double d=leveryAB*leverxCB-leverxAB*leveryCB;
double d1=SumTorque1*leverxCB+SumTorque2*leverxAB;
double d2=SumTorque2*leveryAB+SumTorque1*leveryCB;

double R21x=d1/d;
double R21y=d2/d;

B->R1->SetForce(R21x,R21y,0);
B->R2->SetForce(-R21x,-R21y,0);

double SumFx1=0;
double SumFy1=0;

for (list<Force *>::iterator f = s1->forces.begin(); f!=s1->forces.end(); f++)
    {
        Force  *Fi = *f;
        if(Fi->IsCalculatedx())
            SumFx1+=Fi->GetForcex();
        if(Fi->IsCalculatedy())
            SumFy1+=Fi->GetForcey();
    }

double RAx=-SumFx1;
double RAy=-SumFy1;


A->R1->SetForce(RAx,RAy,0);
A->R2->SetForce(-RAx,-RAy,0);

double SumFx2=0;
double SumFy2=0;

for (list<Force *>::iterator f = s2->forces.begin(); f!=s2->forces.end(); f++)
    {
        Force  *x = *f;
//.........这里部分代码省略.........
开发者ID:just-another-one-timmy,项目名称:mechanism-cpp,代码行数:101,代码来源:GroupTTT.cpp


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