archimedean-spiral-layout
An algorithm that can be used to place items collision-free within a bounding box that contains obstacles.
🚀 Getting Started
Using npm
:
npm install --save archimedean-spiral-layout
Using yarn
:
yarn add archimedean-spiral-layout
✍️ Example
import shouldLayout from 'archimedean-spiral-layout';
const bounds = [ 0, 0, 1024, 768 ];
const obstacles = [
[ 120, 402, 78 ],
[ 453, 329, 39 ],
];
const objectsToPlace = [ 205, 404, 90 ];
shouldLayout(bounds, obstacles, objectsToPlace);
✌️ License
MIT