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 in JavaScript
Install
This package is published on NPM @kitsuyui/rectangle-dividing
# or
# or
Example
import from "@kitsuyui/rectangle-dividing";
const rect = ;
const weights: Float32Array = Float32Array.;
const aspectRatio = 1.5;
const verticalFirst = true;
const boustrophedron = true;
const divided = ;
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