Planning & Search in Rust
Esc

Loading…

↑↓ move ↵ open Esc close
Colour theme
All algorithms

Theta*

Also known as Theta star

search heuristic-search

Theta* finds short any-angle paths on a grid: paths of straight segments between cell centres, not only along grid edges. It runs A* over the 8-connected moves with the Euclidean distance as heuristic. When it reaches a cell s′ from s, it tests whether s′ can see the parent of s. If it can, s′ takes that parent as its own, so the path skips s in one straight line. The path is not always the shortest any-angle path, but it is never longer than the cheapest 8-connected path. Use it for natural-looking paths for robots and game characters.

Pseudocode

algorithm Theta*(s₀, s-goal)input: start cell s₀, goal cell s-goal of a grid with line-of-sight testsoutput: an any-angle path of straight segments between cell centres, or failureg[s₀] ← 0parent[s₀] ← s₀OPEN ← {s₀}                                  ▷ ordered by g + d(s, s-goal), d Euclideanwhile OPEN ≠ ∅ dos ← extract-min(OPEN)if s = s-goal thenreturn path-to(s)                        ▷ the corners, from s₀ to s-goalCLOSED ← CLOSED ∪ {s}for each free 8-neighbour s′ of s, without corner cutting doif s′ ∉ CLOSED thenif line-of-sight(parent[s], s′) then   ▷ skip s: one straight segmentp ← parent[s]else                                   ▷ the grid edge from sp ← sif g[p] + d(p, s′) < g[s′] theng[s′] ← g[p] + d(p, s′)parent[s′] ← pinsert-or-update(OPEN, s′, g[s′] + d(s′, s-goal))return failure

In the crates

Lineage

Comes from

builds on A*

Led to

Lazy Theta* builds on it

Papers

  1. Theta*: Any-Angle Path Planning on Grids Alex Nash, Kenny Daniel, Sven Koenig, Ariel Felner · 2007· Proceedings of the Twenty-Second AAAI Conference on Artificial Intelligence introduces