@kenzotakahashi/autofloor-lib
v0.7.4
Published
libraries for autofloor
Readme
Autofloor Library
Autofloorで使うライブラリです。
Install
npm install -D @kenzotakahashi/autofloor-libfindRooms
壁から部屋を見つけます。outlineに依存しています。
import {findRooms} from 'autofloor-lib'
import {constructWallOutline} from '@kenzotakahashi/autofloor-calc-outline'
const walls = [
[[1,3],[3.5,3]],
[[1,3],[1.2,0.8]],
[[1.2,0.8],[3.5,0.8]],
[[3.5,0.8],[5.5,0.8]],
[[3.5,0.8],[3.5,3]],
[[5.5,0.8],[5.5,3]],
[[3.5,3],[5.5,3]]
]
const [rooms, outlines] = findRooms(constructWallOutline(walls))
console.log(rooms)Output
[ [ [ 1.0832224943005666, 2.9240000000000004 ],
[ 1.2694043124823846, 0.8760000000000003 ],
[ 3.424, 0.876 ],
[ 3.424, 2.924 ] ],
[ [ 3.576, 2.924 ],
[ 5.424, 2.924 ],
[ 5.424, 0.876 ],
[ 3.576, 0.876 ] ] ]