summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormvglasow <michael -at- vonglasow.com>2017-12-01 00:09:43 +0100
committermvglasow <michael -at- vonglasow.com>2017-12-01 00:09:43 +0100
commitc4eca636808b0d426e211a6ce8b862ec5e727b8d (patch)
tree0870959ed9a51d3e9443e5a08b7296b370767a82
parentc1bfbaedd977d3f853c23fc58a78ef0daaac79b5 (diff)
downloadnavit-c4eca636808b0d426e211a6ce8b862ec5e727b8d.tar.gz
Refactor:core:Documentation in trasform.c
Signed-off-by: mvglasow <michael -at- vonglasow.com>
-rw-r--r--navit/transform.c31
1 files changed, 31 insertions, 0 deletions
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)
{