本文整理汇总了C++中Led::getType方法的典型用法代码示例。如果您正苦于以下问题:C++ Led::getType方法的具体用法?C++ Led::getType怎么用?C++ Led::getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Led
的用法示例。
在下文中一共展示了Led::getType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: overlaps
bool Chirp::overlaps(Led led) {
float maxMoveDistance = lastSeen * Config::getRobotSpeed();
float maxRotation = lastSeen * Config::getRobotRotation();
float distance = util::distance(position, led.getPoint());
switch(led.getType()) {
case Led::RED:
return distance + maxMoveDistance < Config::getRobotDiameter();
case Led::BLUE:
return distance + maxMoveDistance < Config::getRobotDiameter() / 2 + Config::getCameraLedSize();
case Led::GREEN:
return distance + maxMoveDistance < (1/2.0 + 1.0/4.0) * Config::getRobotDiameter();
}
}
示例2: closeTo
bool Chirp::closeTo(Led led) {
float maxMoveDistance = lastSeen * Config::getRobotSpeed();
float maxRotation = lastSeen * Config::getRobotRotation();
float distance = util::distance(position, led.getPoint());
switch(led.getType()) {
case Led::RED:
return distance < maxMoveDistance;
case Led::BLUE:
return distance < maxMoveDistance + Config::getRobotDiameter() / 2;
case Led::GREEN:
// TODO: function currently assumes the robot is rotated towards the green light, use maxRotation to gain increased precision
return distance < maxMoveDistance + Config::getRobotDiameter() / 4;
}
}