summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormvglasow <michael@vonglasow.com>2017-12-02 20:14:54 +0100
committerGitHub <noreply@github.com>2017-12-02 20:14:54 +0100
commit71fd7de0e8181238fe56b94ad825375b719a31f5 (patch)
tree87caced215650e217080344e0cae0ee3c18696d4
parent1d104b283248c3f45096618c58bef8429d37bcfb (diff)
parented3e331f4c02e618f2b77455b8dc46bb0b740dd3 (diff)
downloadnavit-71fd7de0e8181238fe56b94ad825375b719a31f5.tar.gz
Merge pull request #379 from mvglasow/doc
Add documentation
-rw-r--r--navit/route.c4
-rw-r--r--navit/transform.c31
2 files changed, 33 insertions, 2 deletions
diff --git a/navit/route.c b/navit/route.c
index 2251ffb7f..c67455902 100644
--- a/navit/route.c
+++ b/navit/route.c
@@ -250,8 +250,8 @@ struct route {
struct route_graph *graph; /**< Pointer to the route graph */
struct route_path *path2; /**< Pointer to the route path */
- struct map *map;
- struct map *graph_map;
+ struct map *map; /**< The map containing the route path */
+ struct map *graph_map; /**< The map containing the route graph */
struct callback * route_graph_done_cb ; /**< Callback when route graph is done */
struct callback * route_graph_flood_done_cb ; /**< Callback when route graph flooding is done */
struct callback_list *cbl2; /**< Callback list to call when route changes */
diff --git a/navit/transform.c b/navit/transform.c
index 1c6eeae67..8a6713ab6 100644
--- a/navit/transform.c
+++ b/navit/transform.c
@@ -1187,6 +1187,14 @@ transform_overflow_possible_if_squared(int count, ...) {
return result;
}
+/**
+ * @brief Determines the squared Mercator distance between two points.
+ *
+ * @param c0 The first coordinate
+ * @param c1 The second coordinate
+ *
+ * @return The squared distance between `c1` and `c2`, or `INT_MAX` if an overflow occurs.
+ */
int
transform_distance_sq(struct coord *c1, struct coord *c2)
{
@@ -1216,6 +1224,17 @@ transform_distance_sq_pc(struct pcoord *c1, struct pcoord *c2)
return transform_distance_sq(&p1, &p2);
}
+/**
+ * @brief Determines the point on a line segment that is closest to a reference point, and its distance
+ * from the reference point.
+ *
+ * @param l0 The first coordinate of the line segment
+ * @param l1 The second coordinate of the line segment
+ * @param ref The reference point
+ * @param lpnt Receives the coordinates of the point on the line segment that is closest to `ref`, can be `NULL`
+ *
+ * @return The square of the Mercator distance between `ref` and `lpnt`, or `INT_MAX` if an overflow occurred
+ */
int
transform_distance_line_sq(struct coord *l0, struct coord *l1, struct coord *ref, struct coord *lpnt)
{
@@ -1287,6 +1306,18 @@ transform_distance_line_sq_float(struct coord *l0, struct coord *l1, struct coor
return transform_distance_sq_float(&l, ref);
}
+/**
+ * @brief Determines the point on a polyline that is closest to a reference point, and its distance
+ * from the reference point.
+ *
+ * @param c An array containing the coordinates of the polyline
+ * @param count Number of elements in `c`
+ * @param ref The reference point
+ * @param lpnt Receives the coordinates of the point on the polyline that is closest to `ref`, can be `NULL`
+ * @param pos Receives the index of the line segment containing `lpnt`, can be NULL
+ *
+ * @return The square of the Mercator distance between `ref` and `lpnt`, or `INT_MAX` if an overflow occurred
+ */
int
transform_distance_polyline_sq(struct coord *c, int count, struct coord *ref, struct coord *lpnt, int *pos)
{