-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpath.h
More file actions
61 lines (49 loc) · 1.29 KB
/
path.h
File metadata and controls
61 lines (49 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef __IS_PATH__
#define __IS_PATH__
#include <vector>
/* struct Path_
*
* Stores x and y coordinates, pointers to neighbors, and
* pointers to the places where cells are pointing to it
* (so that it can disconnect itself from the cells when
* being deleted).
*/
class Path {
public:
int id;
Path* prev;
Path* next;
double x, y, z;
std::vector<Path**> ptrs;
Path (float x, float y, int id) : id(id), prev(NULL), next(NULL), x(x), y(y), z(0.0) { }
};
/* backtrace
*
* Travels backwards along a path until reaching a start node
* or the orig node.
*/
Path* backtrace_path(Path* const p, Path* const orig);
/* disconnect_path
*
* Removes a path from the ptrs array, using the self
* ptrs stored in each path node.
*/
void disconnect_path(Path* const p);
/* decimate_path
*
* Removes nodes in the path that can be removed without significant error.
* Returns a new start node, which will be different if the original start
* node is removed during the decimation.
*/
Path* decimate_path(Path* start, float error);
/* free_paths
*
* Frees each path in an array and the array itself.
*/
void free_paths(Path** const paths, int count);
/* free_path
*
* Frees a single path, disconnecting nodes from their referents.
*/
void free_path(Path* const start);
#endif