Finds the Manhattan distance between p1 and p2.
p1
p2
The inputs may be plain objects with x, y, and/or z keys, Vectors, or Agents with x, y, and/or z data.
x
y
z
Vector
Agent
const a1 = new Agent();const a2 = new Agent({ x: 3, y: 4 });manhattanDistance(a1, a2); // returns 7 (defaults to x = 0 and y = 0 for a1)const p1 = { x: 3, y: 2 };const p2 = { x: 0, y: 4 };manhattanDistance(p1, p2); // returns 5 Copy
const a1 = new Agent();const a2 = new Agent({ x: 3, y: 4 });manhattanDistance(a1, a2); // returns 7 (defaults to x = 0 and y = 0 for a1)const p1 = { x: 3, y: 2 };const p2 = { x: 0, y: 4 };manhattanDistance(p1, p2); // returns 5
0.0.12
Finds the Manhattan distance between
p1andp2.The inputs may be plain objects with
x,y, and/orzkeys,Vectors, orAgents withx,y, and/orzdata.