Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Dijkstra

Dijkstra's algorithm is a breadth first search to find the goal. This makes it slower than AStar in most cases, as it doesn't know how to 'guess' if a tile is closer to the goal or not. However in most cases the difference in speed is negligible, and this version of Dijkstra's algorithm can occasionally result in more 'normal' looking paths.

Hierarchy

  • Dijkstra

Index

Constructors

Properties

Methods

Constructors

constructor

Properties

Readonly topology

topology: "four" | "eight"

Methods

compute

  • Computes a given path from a start and end point. If not path is found, it will return undefined. Both the start + end points will be returned in the path.

    Parameters

    • start: Vector2

      Vector2 - The starting point

    • end: Vector2

      Vector2 - The ending point

    Returns Vector2[] | undefined

    RangeVector2[] | undefined - Returns the path, including start + end, or undefined if no path is found.

Generated using TypeDoc