Calculate distance between block.
Distance is calculated from the center of the block.
import { Block, calculateBlockDistance } from "blockwise";const a: Block = { x: 0, y: 0, w: 1, h: 1 };const b: Block = { x: 1, y: 0, w: 1, h: 1 };const distance = calculateBlockDistance(a, b);console.log(distance); // 1 Copy
import { Block, calculateBlockDistance } from "blockwise";const a: Block = { x: 0, y: 0, w: 1, h: 1 };const b: Block = { x: 1, y: 0, w: 1, h: 1 };const distance = calculateBlockDistance(a, b);console.log(distance); // 1
Calculate distance between block.
Distance is calculated from the center of the block.
Example