#include "pathqueue.h"


Go to the source code of this file.
Classes | |
| struct | _Line |
| struct | _PathPoint |
Typedefs | |
| typedef struct _Line | Line |
| typedef struct _PathPoint | PathPoint |
Functions | |
| int | path_simplifier (double *path, int nbpoints, PathPoint *first_point, double *angle) |
| void | freePathMemory (PathPoint *simple_path) |
Definition in file path_simplifier.h.
| typedef struct _PathPoint PathPoint |
Implementation of a list of points
| int path_simplifier | ( | double * | path, | |
| int | nbpoints, | |||
| PathPoint * | first_point, | |||
| double * | angle | |||
| ) |
Simplify a given path
| path | A pointer to a list of points of the original path | |
| nbpoints | Number of points of the original path | |
| first_point | [out] A pointer to the list of points of simplest path | |
| angle | [out] Angle of the last line |
This is an algorithm who tries to simplify the path given by A* Algorithm (
first_index = 0;
last_index = nbpoints;
step = (last_index - first_index)/2
WHILE (the first index less than nbpoints )
Calc the line
FOR all the points between path[first_index] and path[last_index]
calc the distance betwen the point and the line
Take the max_error
END FOR
IF max_error less than ACCEPTABLE_ERROR THEN
The line is part of the simple path.
first_index = last_index
last_index = last_index + step
ELSE reduce last_index
step = (last_index - first_index)/2
last_index = last_index - step;
END IF
END WHILE
Definition at line 106 of file path_simplifier.c.
References calc_dist(), calc_line(), newPathPoint(), _PathPoint::next, PATH_ERROR, _PathPoint::x, and _PathPoint::y.

1.5.3