本文整理汇总了C++中Position::GetY方法的典型用法代码示例。如果您正苦于以下问题:C++ Position::GetY方法的具体用法?C++ Position::GetY怎么用?C++ Position::GetY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Position
的用法示例。
在下文中一共展示了Position::GetY方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drivePath
/**
* @brief
*
* @param path
* @return bool
*/
bool NewRoboControl::drivePath(std::vector<Position>* path)
{
Position *target = NULL;
for (std::vector<Position>::iterator it = path->begin() ; it != path->end() ; it++)
{
target = &(*it);
if (!IsOnTarget(*target, false))
{
double d = 0;
Position prevPos = GetPos();
for (; it != path->end() ; it++)
{
Position pos = *it;
d += pos.DistanceTo(prevPos);
prevPos = pos;
}
return cruisetoBias(target->GetX(), target->GetY(), 700, -10, 30, d);
}
}
if (!target || IsOnTarget(*target))
{
RandomMove();
return true;
}
return cruisetoBias(target->GetX(), target->GetY(), 600);
}
示例2:
/*****************************************************************************
* Function - Operator -
* DESCRIPTION:
*****************************************************************************/
Area Area::operator -(Position& Pos)
{
Area new_area;
new_area.Set(mUpperLeft.GetX() - Pos.GetX(),
mUpperLeft.GetY() - Pos.GetY(),
mLowerRight.GetX() - Pos.GetX(),
mLowerRight.GetY() - Pos.GetY() );
return new_area;
}
示例3: BringPositionWithinArea
/*****************************************************************************
* Function - BringPositionWithinArea
* DESCRIPTION:
* Brings the Position within the area
*****************************************************************************/
void Position::BringPositionWithinArea(Area& Ar)
{
Position UpperLeftPos = Ar.GetUpperLeft();
Position LowerRightPos = Ar.GetLowerRight();
if (mX < UpperLeftPos.GetX())
{
mX = UpperLeftPos.GetX();
}
else if (mX > LowerRightPos.GetX())
{
mX = LowerRightPos.GetX();
}
if (mY < UpperLeftPos.GetY())
{
mY = UpperLeftPos.GetY();
}
else if (mY > LowerRightPos.GetY())
{
mY = LowerRightPos.GetY();
}
}
示例4: IsOnTarget
/**
* @brief this function check if the the robot reach the target
*
* @param current is the current position of the robot
* @param target is the target position of the robot
* @param precise defines how precise the robot should be around the target
* @return bool return ture if the robot reaches the target
*/
bool NewRoboControl::IsOnTarget(Position current, Position target, bool precise)
{
double margin = precise ? 0.05 : 0.2;
return fabs(current.GetX()-target.GetX()) < margin && fabs(current.GetY()-target.GetY()) < margin;
}