Research Article
Autonomic Obstacle Detection and Avoidance in MANETs Driven by Cartography Enhanced OLSR
Algorithm 4
FindNearestInnerPointToEdge function.
Require: | : List of points. | : edge for which we try to find the nearest inner point. | Ensure: Nearest inner point to . | () function FindNearestInnerPointToEdge() | () minDistance ← positiveInfinity | () nearestPoint ← Null | () for each point in do | () previousEdge ← .previousEdge | () nextEdge ← .nextEdge | () distToPreviousEdge ← distanceToEdge(previousEdge, ) | () distToNextEdge ← distanceToEdge(nextEdge, ) | () distTo ← distanceToEdge() | () if ((distTo < minDistance) and (distTo < distToPreviousEdge) and (distTo < distToNextEdge)) then | () minDistance ← distTo | () nearestPoint ← | () end if | () end for | () return nearestPoint | () end function |
|