Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 12, 2005, 4:00:06 AM (20 years ago)
Author:
bensch
Message:

orxonox/branches/trackManager: now nearest works… this was rather strange
what is important is, that the nearest node is not too far from the center (if there is a 3-fork :)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/trackManager/src/track_manager.cc

    r3515 r3516  
    148148
    149149  Vector nodeRelCoord = tmpNode->relCoordinate;
    150 
    151   if (nodeRelCoord.z < 0)
    152     return 0;
    153   else
    154     return 1;
     150  float minDist = 100000000;
     151  int nodeNumber = 0;
     152  for (int i = 0; i < this->childCount; i++)
     153    {
     154      float dist = (nodeRelCoord - this->children[i]->curve->getNode(4)).len();
     155      if (dist < minDist)
     156        {
     157          minDist = dist;
     158          nodeNumber = i;
     159        }
     160    }
     161  PRINTF(3)("PathDecision with nearest algorithm: %d\n", nodeNumber);
     162  return nodeNumber;
    155163}
    156164
     
    432440      break;
    433441    case ENEMYKILLED:
    434       break;
    435     default: // same as LOWEST
    436       tmpElem->condFunc = &TrackElement::lowest;
    437442      break;
    438443    }
Note: See TracChangeset for help on using the changeset viewer.