h = distance(q1,q2)
estimates the cost of propagating from an initial set of states q1 to
final states q2. Each row in q1 and
q2 represents a specific state in the system and the number of columns
matches the number of state variables. The function outputs an n-element
vector h for each q1-q2
pair.