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 ? () |
Methods in detail¶
BinPack2DContainer ( in BinPack2DContainer other )
copy constructor
BinPack2DContainer ( in SInt32 w, in SInt32 h )
default constructor from width and height
default constructor
BinPack2DPackage[] BinPack2DContainer.GetPackages? ()
returns all placed packages inside of the container
Boolean BinPack2DContainer.Place! ( in BinPack2DPackage inPackage )
Boolean BinPack2DContainer.Place! ( in BinPack2DPackage packages[] )
places an array of packages into the container
Boolean BinPack2DContainer.Place! ( in BinPack2DPackage packages[], io BinPack2DPackage remainder[] )
places an array of packages into the container. remaining packages are returned in remainder. packages are sorted by size automatically prior to placement.
Boolean BinPack2DContainer.Use! ( in BinPack2DPackage inPackage, in UInt32 indexToConsume )
BinPack2DContainer BinPack2DContainer.clone? ()
clone method