MeVisLab Toolbox Reference
WEMShortestPath.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2007, MeVis Medical Solutions AG
4 **
5 ** The user may use this file in accordance with the license agreement provided with
6 ** the Software or, alternatively, in accordance with the terms contained in a
7 ** written agreement between the user and MeVis Medical Solutions AG.
8 **
9 ** For further information use the contact form at https://www.mevislab.de/contact
10 **
11 **************************************************************************************/
12 
13 #pragma once
14 
16 
17 #include <algorithm>
18 
19 ML_START_NAMESPACE
20 
22 #define WEM_SHORTESTPATH_TRAVERSED_BIT 15
23 
30 namespace WEMShortestPath
31 {
33  typedef std::vector<WEMNode*> WEMNodeVector;
34 
40  MLWEM_EXPORT void shortestPath(WEMPatch* wemPatch, WEMNode* startNode, WEMNode* destNode, std::vector<unsigned int>& pathNodesEntryNumbers);
41 
42  // Not exporting the methods below to simulate their former private state
43 
44 
47  WEMNode* _extractMin(WEMNodeVector& R, double*& distances);
48 
51  WEMNode* _extractMax(double*& distances, WEMPatch* wemPatch);
52 
53 
56  void _addToBorder(WEMNodeVector& R, WEMNode* node, double* distances, WEMNode** previousNodes);
57 };
58 
59 ML_END_NAMESPACE
#define MLWEM_EXPORT
Definition: MLWEMSystem.h:18
@ R
Definition: SoKeyGrabber.h:69
Defines the mesh component: node.
Definition: WEMNode.h:33
Base class for triangle and quad patches.
Definition: WEMPatch.h:48
std::vector< WEMNode * > WEMNodeVector
Internal vector holds the temporary WEMNode front nodes.
MLWEM_EXPORT void shortestPath(WEMPatch *wemPatch, WEMNode *startNode, WEMNode *destNode, std::vector< unsigned int > &pathNodesEntryNumbers)
Computes the shortest path along edges of the wemPatch, from the startNode to the destNode.
WEMNode * _extractMin(WEMNodeVector &R, double *&distances)
Helper method: searches for the shortest edge in the WEMNodeVector R, erases the according node from ...
void _addToBorder(WEMNodeVector &R, WEMNode *node, double *distances, WEMNode **previousNodes)
Helper method: adds all unvisited nodes to R, and updates the distances array and the previousNodes a...
WEMNode * _extractMax(double *&distances, WEMPatch *wemPatch)
Helper method: searches for the node with maximal distance, and returns a pointer to this node.