šŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →
Socket
Sign inDemoInstall
Socket

potpack

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

potpack

A tiny library for packing 2D rectangles (for sprite layouts)

2.0.0
latest
Source
npm
Version published
Weekly downloads
2M
6.45%
Maintainers
1
Weekly downloads
Ā 
Created

What is potpack?

The potpack npm package is a utility for packing rectangles into a single bin. It is useful for tasks such as packing images into a texture atlas or arranging elements in a confined space efficiently.

What are potpack's main functionalities?

Rectangle Packing

This feature allows you to pack a list of rectangles into a single bin. The function returns the width and height of the bin and the fill rate. The input rectangles are modified to include their x and y positions in the bin.

const potpack = require('potpack');

const rectangles = [
  { w: 100, h: 200 },
  { w: 300, h: 100 },
  { w: 50, h: 50 }
];

const { w, h, fill } = potpack(rectangles);
console.log(`Packed width: ${w}, height: ${h}, fill: ${fill}`);
console.log('Rectangles:', rectangles);

Other packages similar to potpack

Keywords

algorithms

FAQs

Package last updated on 17 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts