rust-rectangle-dividing
A library of rectangle dividing written in Rust. It can be compiled to WebAssembly. So you can use it in JavaScript.
Motivation
I want to divide a rectangle into smaller rectangles by given conditions (weights, aspect ratio, etc.).
Mainly, I want to use this for generating a map for my react-playground
- https://github.com/kitsuyui/react-playground
- https://react-playground.docs.kitsuyui.com/storybook/?path=/docs/base-treemap-introduction--docs
Usage
import dividing from "rust-rectangle-dividing";
const rect = ;
const weights = ;
const divided = dividing.;
Result
dividing's arguments are
rect: The rectangle to be dividedweights: The weights of each rectangleisVertical: The direction of the first divisionaspectRatio: The aspect ratio of each rectangleboustrophedon: The direction of the next division in the same level
License
MIT