BinPack2DContainer.kl

Types

BinPack2DContainer (struct)

A BinPack2DContainer is used to place an array of packages. This is Useful for stacking boxes in a 2D space, for example. The BinPack2DContainer is used by the Geometry extension to create UV spaces, for example.

/*
** Example: Place some packages
*/

// create a container
BinPack2DContainer container(128, 128);

// create some packages
BinPack2DPackage packages[];
packages.push(BinPack2DPackage(0, 64, 32));
packages.push(BinPack2DPackage(1, 126, 2));
packages.push(BinPack2DPackage(2, 16, 16));

container.Place(packages);

packages = container.GetPackages();
for(Size i=0;i<packages.size();i++)
  report(packages[i]);

Members

BinPack2DRegion region  
BinPack2DRegion[] regions  
UInt32 numRegions  
BinPack2DPackage[] packages  

Methods

  BinPack2DContainer ( in BinPack2DContainer other )
  BinPack2DContainer ( in SInt32 w, in SInt32 h )
  BinPack2DContainer ()
BinPack2DPackage[] GetPackages ? ()
Boolean Place ! ( in BinPack2DPackage inPackage )
Boolean Place ! ( in BinPack2DPackage packages[] )
Boolean Place ! ( in BinPack2DPackage packages[], io BinPack2DPackage remainder[] )
Boolean Use ! ( in BinPack2DPackage inPackage, in UInt32 indexToConsume )
BinPack2DContainer clone ? ()