From ecd2c5d5b9cfea6114f3830a20ade5c749c00302 Mon Sep 17 00:00:00 2001 From: Yuri Rubinsky Date: Wed, 14 Dec 2022 16:35:02 +0300 Subject: Improve documentation on heuristics in AStarGrid2D --- doc/classes/AStarGrid2D.xml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/doc/classes/AStarGrid2D.xml b/doc/classes/AStarGrid2D.xml index 8dde3748d7..bffa395770 100644 --- a/doc/classes/AStarGrid2D.xml +++ b/doc/classes/AStarGrid2D.xml @@ -103,6 +103,7 @@ Disables or enables the specified point for pathfinding. Useful for making an obstacle. By default, all points are enabled. + [b]Note:[/b] Calling [method update] is not needed after the call of this function. @@ -134,20 +135,22 @@ - The Euclidean heuristic to be used for the pathfinding using the following formula: + The [url=https://en.wikipedia.org/wiki/Euclidean_distance]Euclidean heuristic[/url] to be used for the pathfinding using the following formula: [codeblock] dx = abs(to_id.x - from_id.x) dy = abs(to_id.y - from_id.y) result = sqrt(dx * dx + dy * dy) [/codeblock] + [b]Note:[/b] This is also the internal heuristic used in [AStar3D] and [AStar2D] by default (with the inclusion of possible z-axis coordinate). - The Manhattan heuristic to be used for the pathfinding using the following formula: + The [url=https://en.wikipedia.org/wiki/Taxicab_geometry]Manhattan heuristic[/url] to be used for the pathfinding using the following formula: [codeblock] dx = abs(to_id.x - from_id.x) dy = abs(to_id.y - from_id.y) result = dx + dy [/codeblock] + [b]Note:[/b] This heuristic is intended to be used with 4-side orthogonal movements, provided by setting the [member diagonal_mode] to [constant DIAGONAL_MODE_NEVER]. The Octile heuristic to be used for the pathfinding using the following formula: @@ -159,7 +162,7 @@ [/codeblock] - The Chebyshev heuristic to be used for the pathfinding using the following formula: + The [url=https://en.wikipedia.org/wiki/Chebyshev_distance]Chebyshev heuristic[/url] to be used for the pathfinding using the following formula: [codeblock] dx = abs(to_id.x - from_id.x) dy = abs(to_id.y - from_id.y) -- cgit v1.2.3