本文整理汇总了C++中Plane::GetX方法的典型用法代码示例。如果您正苦于以下问题:C++ Plane::GetX方法的具体用法?C++ Plane::GetX怎么用?C++ Plane::GetX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plane
的用法示例。
在下文中一共展示了Plane::GetX方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetCMatrix
bool Restraint::GetCMatrix(const Plane structureOrientation, arma::mat & CN)
{
// Check if restraint plane differs from global plane
if (structureOrientation.CompareTo(this->_orientation))
return false;
// If different
CN = arma::mat(6, 6, arma::fill::zeros);
Vector3d drX = this->GetXDir();
Vector3d drY = this->GetYDir();
Vector3d drZ = this->GetZDir();
Vector3d strX = structureOrientation.GetX();
Vector3d strY = structureOrientation.GetY();
Vector3d strZ = structureOrientation.GetZ();
double nxx = drX.DotProduct(strX);
double nxy = drY.DotProduct(strY);
double nxz = drZ.DotProduct(strZ);
double nyx = drX.DotProduct(strX);
double nyy = drY.DotProduct(strY);
double nyz = drZ.DotProduct(strZ);
double nzx = drX.DotProduct(strX);
double nzy = drY.DotProduct(strY);
double nzz = drZ.DotProduct(strZ);
// Two times for same transformations for translations (1) and rotations(2)
for (int i = 0; i < 2; i++)
{
CN[0 + i * 3, 0 + i * 3] = nxx;
CN[0 + i * 3, 1 + i * 3] = nxy;
CN[0 + i * 3, 2 + i * 3] = nxz;
CN[1 + i * 3, 0 + i * 3] = nyx;
CN[1 + i * 3, 1 + i * 3] = nyy;
CN[1 + i * 3, 2 + i * 3] = nyz;
CN[2 + i * 3, 0 + i * 3] = nyx;
CN[2 + i * 3, 1 + i * 3] = nyy;
CN[2 + i * 3, 2 + i * 3] = nyz;
}
return true;
}
示例2: BulletMove
//.........这里部分代码省略.........
}
else if (m_iStep == STEP_3)
{
m_iSpeed += m_iAcceleration;
if (m_iSpeed >= m_iFinalSpeed)
{
m_iSpeed = m_iFinalSpeed;
}
}
radian = m_iDirection/180 * PI;
SetX(m_iX + m_iSpeed*sin(radian));
SetY(m_iY + m_iSpeed*cos(radian));
break;
case 3: //×·×Ùµ¼µ¯
switch (m_iStep)
{
case STEP_1:
m_iAngle = m_iDirection/180 * PI;
SetX(m_iX + m_iSpeed*sin(m_iAngle));
SetY(m_iY + m_iSpeed*cos(m_iAngle));
if (g_Time - m_Time > 500)
{
m_iStep = STEP_2;
}
break;
case STEP_2:
{
vector<Plane *>* tempPlanes = g_Manager.GetPlaneVector();
for (int i=1; i<(int)tempPlanes->size(); i++)
{
if ((*tempPlanes)[i])
{
m_iTarget = i;
break;
}
}
m_iStep = STEP_3;
}
break;
case STEP_3:
if (m_iTarget != -1)
{
Plane *target = (*g_Manager.GetPlaneVector())[m_iTarget];
if (target)
{
m_iDesX = target->GetX();
m_iDesY = target->GetY();
m_iAngle = atan((double)(m_iDesX-m_iX)/(double)(m_iDesY-m_iY));
m_iDirection = m_iAngle*180/PI;
if (m_iDesY > m_iY)
{
SetX(m_iX + m_iSpeed*sin(m_iAngle));
SetY(m_iY + m_iSpeed*cos(m_iAngle));
}
else if(m_iDesY < m_iY)
{
SetX(m_iX - (int)(m_iSpeed*sin(m_iAngle)));
SetY(m_iY - (int)(m_iSpeed*cos(m_iAngle)));
}
else
{
if (m_iDesX > m_iX)
{
SetX(m_iX+m_iSpeed);
}
else
{
SetX(m_iX-m_iSpeed);
}
}
}
else
{
m_iTarget = -1;
}
}
else
{
m_iAngle = m_iDirection/180 * PI;
SetX(m_iX + m_iSpeed*sin(m_iAngle));
SetY(m_iY + m_iSpeed*cos(m_iAngle));
}
break;
}
break;
}
}
示例3: UpdatePlane
void PlaneGuard::UpdatePlane()
{
Plane *target = (*g_Manager.GetPlaneVector())[m_Target];
if (!target)
{
m_iState = P_DISAPPEAR;
return;
}
if (m_bMoveable)
{
m_iDirection += m_iSpeed;
if (m_iDirection >= 360)
{
m_iDirection -= 360;
}
m_Angle = m_iDirection/180 * PI;
SetX(target->GetX() + (int)(m_Distance*sin(m_Angle)));
SetY(target->GetY() + (int)(m_Distance*cos(m_Angle)));
//¸üз¢ÉäÆ÷µÄλÖÃ
for (int i=0; i<(int)m_vShooterGroup.size(); i++)
{
for (int j=0; j<(int)m_vShooterGroup[i].size(); j++)
{
m_vShooterGroup[i][j]->SetPos(m_iX, m_iY);
}
}
}
//·¢Éä
m_bFireOver = true;
vector<Shooter*> *pShooters = &m_vShooterGroup[m_iNowShooterGroup];
for (int i=0; i<(int)pShooters->size(); i++)
{
if (m_bFireCommand)
{
(*pShooters)[i]->SetCommand(true);
m_bFireOver &= (*pShooters)[i]->Fire(false);
}
}
if (m_bFireOver)
{
m_iNowShooterGroup++;
if (m_iNowShooterGroup >= (int)pShooters->size())
{
m_iNowShooterGroup = 0;
}
for (int i=0; i<(int)pShooters->size(); i++)
{
(*pShooters)[i]->SetCommand(false);
(*pShooters)[i]->Reload();
}
}
if (m_bImpactable)
{
//Åöײ²¿·Ö
}
}