pathfinding3d.core.world module

class pathfinding3d.core.world.World(grids)[source]

Bases: object

A world connects grids but can have multiple grids.

Parameters:

grids (Dict[int, Grid]) –

__init__(grids)[source]

Initialize a new world.

Parameters:

grids (Dict[int, Grid]) – grids in this world

neighbors(node, diagonal_movement)[source]

Get neighbors of the given node.

Parameters:
  • node (GridNode) – node to get neighbors from

  • diagonal_movement (int) – if diagonal movement is allowed (see enum in diagonal_movement)

Returns:

neighbors of the given node

Return type:

List[GridNode]

calc_cost(node_a, node_b, weighted=False)[source]

Calculate the cost between two nodes.

Parameters:
  • node_a (GridNode) – first node

  • node_b (GridNode) – second node

  • weighted (bool) – wether to use weights or not

Returns:

cost between the two nodes

Return type:

float

cleanup()[source]

Cleanup all grids in this world.