class

PointClickEngine::Navigation::Node

Inherits Reference < Object

Represents a pathfinding graph node for A* algorithm

The Node class contains the essential data for pathfinding algorithms:

  • Position coordinates (x, y)
  • Cost calculations (g_cost, h_cost, f_cost)
  • Parent reference for path reconstruction

Constructors

new(x : Int32, y : Int32, g_cost : Float32 = 0.0_f32, h_cost : Float32 = 0.0_f32, parent : Nil | PointClickEngine::Navigation::Node = nil)
Source

Instance methods

==(other : Node)

Two nodes are equal if they have the same coordinates

Source
adjacent_to?(other : Node) : Bool

Check if this node is adjacent to another (including diagonals)

Source
diagonally_adjacent_to?(other : Node) : Bool

Check if this node is diagonally adjacent

Source
distance_to(other : Node) : Float32

Distance to another node (for debugging/validation)

Source
f_cost

F cost is the sum of G and H costs (A* evaluation function)

Source
g_cost

A* algorithm costs

Source
g_cost=(g_cost : Float32)

A* algorithm costs

Source
h_cost
Source
h_cost=(h_cost : Float32)
Source
hash

Hash function for using nodes in hash-based collections

Source
manhattan_distance_to(other : Node) : Int32

Manhattan distance to another node

Source
orthogonally_adjacent_to?(other : Node) : Bool

Check if this node is orthogonally adjacent (no diagonals)

Source
parent

Path reconstruction

Source
parent=(parent : Node | Nil)

Path reconstruction

Source
to_s(io : IO) : Nil

String representation for debugging

Source
with_costs(g_cost : Float32, h_cost : Float32, parent : Node | Nil = nil) : Node

Creates a copy of this node with updated costs

Source
x

Grid coordinates

Source
x=(x : Int32)

Grid coordinates

Source
y=(y : Int32)
Source