pathfinding3d.core.node module

class pathfinding3d.core.node.Node[source]

Bases: object

Basic node class, saves calculated values for pathfinding

h

The cost from this node to the goal (for A* including the heuristic).

Type:

float

g

The cost from the start node to this node.

Type:

float

f

The overall cost for a path using this node (f = g + h).

Type:

float

opened

The number of times this node has been opened.

Type:

int

closed

Whether this node is closed.

Type:

bool

parent

The parent node of this node.

Type:

Optional[Node]

retain_count

Used for recursion tracking of IDA*.

Type:

int

tested

Used for IDA* and Jump-Point-Search.

Type:

bool

__init__()[source]
cleanup()[source]

Reset all calculated values, fresh start for pathfinding

h
g
f
opened
closed
parent
retain_count
tested
class pathfinding3d.core.node.GridNode(x=0, y=0, z=0, walkable=True, weight=1.0, grid_id=None, connections=<factory>)[source]

Bases: Node

Basic node in a grid.

Parameters:
x

The x coordinate of the node.

Type:

int

y

The y coordinate of the node.

Type:

int

z

The z coordinate of the node.

Type:

int

walkable

Whether this node can be walked through.

Type:

bool

weight

The weight of the node.

Type:

float

grid_id

The id of the grid this node belongs to.

Type:

Optional[int]

connections

The nodes this node is connected to.

Type:

List[GridNode]

x: int = 0
y: int = 0
z: int = 0
walkable: bool = True
weight: float = 1.0
grid_id: Optional[int] = None
connections: List[GridNode]
connect(other_node)[source]

Connect this node to another node.

Parameters:

other_node (GridNode) – The node to connect to.

h
g
f
opened
closed
parent
retain_count
tested
__init__(x=0, y=0, z=0, walkable=True, weight=1.0, grid_id=None, connections=<factory>)
Parameters:
Return type:

None

cleanup()

Reset all calculated values, fresh start for pathfinding