// Type definitions for 3d-bin-packing // Project: https://github.com/betterwaysystems/packer // Definitions by: Jeongho Nam // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// /// /// /// /// declare module "3d-bin-packing" { export = bws.packer; } declare var ReactDataGrid: typeof AdazzleReactDataGrid.ReactDataGrid; declare namespace boxologic { /** *

An abstract instance of boxologic.

* *

{@link st_Instance} represents a physical, tangible instance of 3-dimension.

* * @author Jeongho Nam */ abstract class Instance { /** * Width of the tangible instance, length on the X-axis in 3D. */ width: number; /** * Height of the tangible instance, length on the Y-axis in 3D. */ height: number; /** * Length of the tangible instance, length on the Z-axis in 3D. */ length: number; /** * Width considering layout placement. */ layout_width: number; /** * Height considering layout placement. */ layout_height: number; /** * Length considering layout placement. */ layout_length: number; /** * Volume, Width x Height x Length. */ volume: number; /** * Construct from size members. * * @param width Width, length on the X-axis in 3D. * @param height Height, length on the Y-axis in 3D. * @param length Length, length on the Z-axis in 3D. */ constructor(width: number, height: number, length: number); } } declare namespace bws.packer { /** * @brief Packer, a solver of 3d bin packing with multiple wrappers. * * @details *

Packer is a facade class supporting packing operations in user side. You can solve a packing problem * by constructing Packer class with {@link WrapperArray wrappers} and {@link InstanceArray instances} to * pack and executing {@link optimize Packer.optimize()} method.

* *

In background side, deducting packing solution, those algorithms are used.

* * * @author Jeongho Nam */ class Packer extends samchon.protocol.Entity { /** * Candidate wrappers who can contain instances. */ protected wrapperArray: WrapperArray; /** * Instances trying to pack into the wrapper. */ protected instanceArray: InstanceArray; /** * Default Constructor. */ constructor(); /** * Construct from members. * * @param wrapperArray Candidate wrappers who can contain instances. * @param instanceArray Instances to be packed into some wrappers. */ constructor(wrapperArray: WrapperArray, instanceArray: InstanceArray); /** * @inheritdoc */ construct(xml: samchon.library.XML): void; /** * Get wrapperArray. */ getWrapperArray(): WrapperArray; /** * Get instanceArray. */ getInstanceArray(): InstanceArray; /** *

Deduct * */ optimize(): WrapperArray; /** * @brief Initialize sequence list (gene_array). * * @details *

Deducts initial sequence list by such assumption:

* *
    *
  • Cost of larger wrapper is less than smaller one, within framework of price per volume unit.
  • *
      *
    • Wrapper Larger: (price: $1,000, volume: 100cm^3 -> price per volume unit: $10 / cm^3)
    • *
    • Wrapper Smaller: (price: $700, volume: 50cm^3 -> price per volume unit: $14 / cm^3)
    • *
    • Larger's cost is less than Smaller, within framework of price per volume unit
    • *
    *
* *

Method {@link initGenes initGenes()} constructs {@link WrapperGroup WrapperGroups} corresponding * with the {@link wrapperArray} and allocates {@link instanceArray instances} to a {@link WrapperGroup}, * has the smallest cost between containbles.

* *

After executing packing solution by {@link WrapperGroup.optimize WrapperGroup.optimize()}, trying to * {@link repack re-pack} each {@link WrapperGroup} to another type of {@link Wrapper}, deducts the best * solution between them. It's the initial sequence list of genetic algorithm.

* * @return Initial sequence list. */ protected initGenes(): GAWrapperArray; /** * Try to repack each wrappers to another type. * * @param $wrappers Wrappers to repack. * @return Re-packed wrappers. */ protected repack($wrappers: WrapperArray): WrapperArray; /** * @inheritdoc */ TAG(): string; /** * @inheritdoc */ toXML(): samchon.library.XML; } } declare namespace flex { class TabNavigator extends React.Component { render(): JSX.Element; private handle_change(index, event); } class NavigatorContent extends React.Component { render(): JSX.Element; } interface TabNavigatorProps extends React.Props { selectedIndex?: number; style?: React.CSSProperties; } interface NavigatorContentProps extends React.Props { label: string; } } declare namespace boxologic { /** * A box, trying to pack into a {@link Pallet}. * * @author Bill Knechtel,
* Migrated and Refactored by Jeongho Nam */ class Box extends Instance { /** * Coordinate-X of the box placement in a {@link Pallet}. */ cox: number; /** * Coordinate-Y of the box placement in a {@link Pallet}. */ coy: number; /** * Coordinate-Z of the box placement in a {@link Pallet}. */ coz: number; /** * Whether the {@link Box} is packed into a {@link Pallet}. */ is_packed: boolean; overlapped_boxes: std.HashSet; /** * Construct from an instance. * * @param instance An instance adapts with. */ constructor(instance: bws.packer.Instance); hit_test(obj: Box): boolean; private hit_test_single(obj); private hit_test_point(x, y, z); } } /** *

A set of programs that calculate the best fit for boxes on a pallet migrated from language C.

* *
    *
  • Original Boxologic: https://github.com/exad/boxologic
  • *
* * @author Bill Knechtel,
* Migrated and Refactored by Jeongho Nam */ declare namespace boxologic { /** *

A facade class of boxologic.

* *

The Boxologic class dudcts the best solution of packing boxes to a pallet.

* *
    *
  • Reference: https://github.com/exad/boxologic
  • *
* * @author Bill Knechtel,
* Migrated and Refactored by Jeongho Nam */ class Boxologic { /** * A Wrapper to pack instances. */ private wrapper; /** * Instances trying to put into the wrapper. */ private instanceArray; /** * Instances failed to pack by overloading. */ private leftInstances; /** * A pallet containing {@link Box boxes}. * * @see Wrapper */ private pallet; /** * Boxes, trying to pack into the {@link pallet}. */ private box_array; /** * Sum of all boxes' volume. */ private total_box_volume; /** *

All different lengths of {@link box_array all box} dimensions along with evaluation values.

* *

In other word, the layer_map stores those entries; each {@link Boxbox}'s length on each * axis as a key (width, height or length) and evaluation value as a value. The evaluation * value means sum of minimum gaps between the key and other {@link Box boxes}' width, height and length *

* * FOR i := 0 to box_array.size() WHILE key IN width, length and height in box_array[i] BEGIN value := 0 FOR j to box_array.size() value += min ( abs(key - box_array[j].width), abs(key - box_array[j].height), abs(key - box_array[j].length) ) layer_map.insert({key, value}); END * * *
    *
  • key: A dimension value
  • *
  • value: Evaluation weight value for the corresponding key.
  • *
*/ private layer_map; /** * {@link List} of {@link Scrapped} instances, edges of layers under construction. * * @see Scrapped * @see scrap_min_z */ private scrap_list; /** * The topology {@link Scrapped}, the edge of the current layer under construction. * * @see Scrapped * @see scrap_list */ private scrap_min_z; /** * Index of the current {@link box}. */ private cboxi; /** * Candidate {@link Box.layout_width layout_width} of the {@link cboxi current box}. */ private cbox_layout_width; /** * Candidate {@link Box.layout_height layout_height} of the {@link cboxi current box}. */ private cbox_layout_height; /** * Candidate {@link Box.layout_length layout_length} of the {@link cboxi current box}. */ private cbox_layout_length; /** * Current layer's key on iteration. */ private layer_thickness; /** * Previous layer's key had iterated. */ private pre_layer; /** * Key of the unevened layer in the current packing layer. */ private layer_in_layer; /** * Little Z, gotten from {@link Scrapped.cumz cumz} in {@link min_scrap_z} */ private lilz; /** * Remained (unfilled) {@link Pallet.layout_height layout_height} of the {@link pallet}. */ private remain_layout_height; /** * Remained (unfilled) {@link Pallet.layout_length layout_length} of the {@link pallet}. */ private remain_layout_length; /** * Packed (filled) {@link Pallet.layout_height layout_height} of the {@link pallet}. */ private packed_layout_height; /** * Packed {@link Pallet.vo1lume volume} of the {@lnk pallet}. */ private packed_volume; private boxi; private bboxi; private boxx; private boxy; private boxz; private bboxx; private bboxy; private bboxz; private bfx; private bfy; private bfz; private bbfx; private bbfy; private bbfz; /** *

Whether the packing is on progress.

* *

The {@link packing} is a flag variable for terminating iterations in * {@link iterate_orientations iterate_orientations()}, who deducts the best packing solution.

*/ private packing; /** * Whether packing a layer is done. */ private layer_done; /** * Whether the current packing layer is evened. */ private evened; /** * Whether the best solution is deducted. */ private packing_best; /** * Whether the utilization degree of pallet space is 100%. */ private hundred_percent; /** * The best orientation of the pallet, which can deduct the {@link best_solution_volume}. */ private best_orientation; /** * The best layer, which can deduct the {@link best_solution_volume}. */ private best_layer; /** * The best volume, fit the best utilization degree of the pallet space. */ private best_solution_volume; /** * Construct from a wrapper and instances. * * @param wrapper A Wrapper to pack instances. * @param instanceArray Instances trying to put into the wrapper. */ constructor(wrapper: bws.packer.Wrapper, instanceArray: bws.packer.InstanceArray); /** *

Encode data

* *

Encodes {@link bws.packer Packer}'s data to be suitable for the * {@link boxologic Boxologic}'s parametric data.

*/ private encode(); /** *

Decode data

* *

Decodes the Boxologic's optimization result data to be suitable for the Packer's own.

*/ private decode(); private inspect_validity(); /** *

Pack instances to the {@link wrapper}.

* *

The {@link Boxologic.pack} is an adaptor method between {@link bws.packer Packer} and * {@link boxologic}. It encodes data from {@link bws.packer Packer}, deducts the best packing * solution decodes the optimization result and returns it.

* *

The optimization result is returned as a {@link Pair} like below:

*
    *
  • first: The {@link wrapper} with packed instances.
  • *
  • second: {@link leftInstances Left instances failed to pack} by overloading.
  • *
* * @return A pair of {@link wrapper} with packed instances and * {@link leftInstances instances failed to pack} by overloading. */ pack(): std.Pair; /** *

Execute iterations by calling proper functions.

* *

Iterations are done and parameters of the best solution are found.

*/ private iterate_orientations(); /** * Iterate a layer. * * @param thickness Thickness of the iterating layer. */ private iterate_layer(thickness); /** *

Construct layers.

* *

Creates all possible layer heights by giving a weight value to each of them.

*/ private construct_layers(); /** *

Packs the boxes found and arranges all variables and records properly.

* *

Update the linked list and the Boxlist[] array as a box is packed.

*/ private pack_layer(); /** * Find the most proper layer height by looking at the unpacked boxes and * the remaining empty space available. */ private find_layer(thickness); /** *

Determine the gap with the samllest z value in the current layer.

* *

Find the most proper boxes by looking at all six possible orientations, * empty space given, adjacent boxes, and pallet limits.

* * @param hmx Maximum available x-dimension of the current gap to be filled. * @param hy Current layer thickness value. * @param hmy Current layer thickness value. * @param hz Z-dimension of the current gap to be filled. * @param hmz Maximum available z-dimension to the current gap to be filled. */ private find_box(hmx, hy, hmy, hz, hmz); /** *

Analyzes each unpacked {@link Box box} to find the best fitting one to the empty space.

* *

Used by {@link find_box find_box()} to analyze box dimensions.

* * @param x index of a {@link Box box} in the {@link box_array}. * * @param hmx Maximum available x-dimension of the current gap to be filled. * @param hy Current layer thickness value. * @param hmy Current layer thickness value. * @param hz Z-dimension of the current gap to be filled. * @param hmz Maximum available z-dimension to the current gap to be filled. * * @param dim1 X-dimension of the orientation of the box being examined. * @param dim2 Y-dimension of the orientation of the box being examined. * @param dim3 Z-dimension of the orientation of the box being examined. */ private analyze_box(index, hmx, hy, hmy, hz, hmz, dim1, dim2, dim3); /** * After finding each box, the candidate boxes and the condition of the layer are examined. */ private check_found(); /** * After packing of each box, 100% packing condition is checked. */ private volume_check(); /** *

Find the first to be packed gap in the layer edge.

* *

Determine the gap with the {@link scrap_min_z smallest z} value in the current layer.

*/ private find_smallest_z(); /** *

Determine {@link box_arrray boxes}.

* *

Using the parameters found, packs the best solution found and reports.

*/ private report_results(); /** *

Determine a {@link Box}.

* *

Transforms the found co-ordinate system to the one entered by the user and write them to the * report.

*/ private write_box_file(); } } declare namespace boxologic { /** * A pallet containing boxes. * * @author Bill Knechtel,
* Migrated and Refactored by Jeongho Nam */ class Pallet extends Instance { /** * Construct from a wrapper. * * @param wrapper A wrapper wrapping instances. */ constructor(wrapper: bws.packer.Wrapper); /** * Set placement orientation. */ set_orientation(orientation: number): void; } } declare namespace boxologic { /** *

Cumulated lengths of current layer.

* *

{@link Scrapped} represents an edge of the current layer under construction.

* * @author Bill Knechtel,
* Migrated and Refactored by Jeongho Nam */ class Scrap { /** * Cumulated length on the X-axis in 3D. */ cumx: number; /** * Cumulated length on the Z-axis in 3D. */ cumz: number; /** * Default Constructor. */ constructor(); /** * Initialization Constructor. * * @param cumx Cumulated length on the x-axis. * @param cumz Cumulated length on the z-axis. */ constructor(cumx: number, cumz: number); } } declare namespace bws.packer { /** * Bridge of {@link Packer} for {@link InstanceForm repeated instances}. * * @author Jeongho Nam */ class PackerForm extends samchon.protocol.Entity { /** * Form of Instances to pack. */ private instanceFormArray; /** * Type of Wrappers to be used. */ private wrapperArray; /** * Default Constructor. */ constructor(); /** * Initializer Constructor. * * @param instanceFormArray Form of Instances to pack. * @param wrapperArray Type of Wrappers to be used. */ constructor(instanceFormArray: InstanceFormArray, wrapperArray: WrapperArray); construct(xml: samchon.library.XML): void; optimize(): WrapperArray; getInstanceFormArray(): InstanceFormArray; getWrapperArray(): WrapperArray; TAG(): string; toXML(): samchon.library.XML; toPacker(): Packer; } /** * An array of {@link InstanceForm} objects. * * @author Jeongho Nam */ class InstanceFormArray extends samchon.protocol.EntityArrayCollection { /** * Default Constructor. */ constructor(); createChild(xml: samchon.library.XML): InstanceForm; TAG(): string; CHILD_TAG(): string; /** * Convert {@link InstanceForm} objects to {@link InstanceArray}. * * @return An array of instance containing repeated instances in {@link InstanceForm} objects. */ toInstanceArray(): InstanceArray; } /** *

A repeated Instance.

* *

InstanceForm is an utility class for repeated {@link Instance}. It is designed for shrinking * volume of network message I/O by storing {@link count repeated count}.

* * @author Jeongho Nam */ class InstanceForm extends samchon.protocol.Entity { /** * A duplicated Instance. */ private instance; /** * Repeated count of the {@link instance}. */ private count; /** * Default Constructor. */ constructor(instance?: Instance, count?: number); /** * @inheritdoc */ construct(xml: samchon.library.XML): void; private createInstance(xml); key(): any; getInstance(): Instance; getCount(): number; setCount(val: number): void; $name: string; $width: string; $height: string; $length: string; $count: string; /** * @inheritdoc */ TAG(): string; /** * @inheritdoc */ toXML(): samchon.library.XML; /** *

Repeated {@link instance} to {@link InstanceArray}. * * @details *

Contains the {@link instance repeated instance} to an {@link InstanceArray} to make * {@link instance} to participate in the packing process. The returned {@link InstanceArray} will be * registered on {@link Packer.instanceArray}. * * @return An array of instance containing repeated {@link instance}. */ toInstanceArray(): InstanceArray; } } declare namespace bws.packer { class WrapperArray extends samchon.protocol.EntityArrayCollection { /** * Default Constructor. */ constructor(); /** * @inheritdoc */ createChild(xml: samchon.library.XML): Wrapper; /** * Get (calculate) price. */ getPrice(): number; /** * Get (calculate) utilization rate. */ getUtilization(): number; /** * @inheritdoc */ TAG(): string; /** * @inheritdoc */ CHILD_TAG(): string; } } declare namespace bws.packer { class GAWrapperArray extends WrapperArray { protected instanceArray: InstanceArray; protected result: std.HashMap; private price; /** * @brief Validity of this sequence list. */ private valid; /** * Construct from instances. * * @param instanceArray Instances to be wrapped. */ constructor(instanceArray: InstanceArray); /** * @brief Copy Constructor. */ constructor(genes: GAWrapperArray); private constructResult(); /** * @brief Get optimization result. * * @return result map. */ getResult(): std.HashMap; less(obj: GAWrapperArray): boolean; } } declare namespace bws.packer { /** * An interface of physical 3D-instances. * * @author Jeongho Nam */ interface Instance extends samchon.protocol.IEntity { /** * Get name. */ getName(): string; /** * Get width, length on the X-axis in 3D. */ getWidth(): number; /** * Get height, length on the Y-axis in 3D. */ getHeight(): number; /** * Get length, length on the Z-axis in 3D. */ getLength(): number; /** * Get (calculate) volume. * * @return width x height x length */ getVolume(): number; /** * Set name. */ setName(val: string): void; /** * Set width, length on the X-axis in 3D. */ setWidth(val: number): void; /** * Set height, length on the Y-axis in 3D. */ setHeight(val: number): void; /** * Set length, length on the Z-axis in 3D. */ setLength(val: number): void; /** *

A type, identifier of derived class.

* *

Derived types

*
    *
  • {@link Product product}
  • *
  • {@link Wrapper wrapper}
  • *
      */ TYPE(): string; } } declare namespace bws.packer { /** * An array of Instance objects. * * @author Jeongho Nam */ class InstanceArray extends samchon.protocol.EntityArray { /** * Default Constructor. */ constructor(); /** * @inheritdoc */ createChild(xml: samchon.library.XML): Instance; /** * @inheritdoc */ TAG(): string; /** * @inheritdoc */ CHILD_TAG(): string; } } declare namespace bws.packer { /** * A product. * * @author Jeongho Nam */ class Product extends samchon.protocol.Entity implements Instance { /** *

      Name, key of the Product.

      * *

      The name must be unique because a name identifies a {@link Product}.

      */ protected name: string; /** * Width of the Product, length on the X-axis in 3D. */ protected width: number; /** * Height of the Product, length on the Y-axis in 3D. */ protected height: number; /** * Length of the Product, length on the Z-axis in 3D. */ protected length: number; /** * Default Constructor. */ constructor(); /** * Construct from members. * * @param name Name, identifier of the Product. * @param width Width, length on the X-axis in 3D. * @param height Height, length on the Y-axis in 3D. * @param length Length, length on the Z-axis in 3D. */ constructor(name: string, width: number, height: number, length: number); /** * Key of a Product is its name. */ key(): any; /** * @inheritdoc */ getName(): string; /** * @inheritdoc */ getWidth(): number; /** * @inheritdoc */ getHeight(): number; /** * @inheritdoc */ getLength(): number; /** * @inheritdoc */ getVolume(): number; /** * @inheritdoc */ setName(val: string): void; /** * @inheritdoc */ setWidth(val: number): void; /** * @inheritdoc */ setHeight(val: number): void; /** * @inheritdoc */ setLength(val: number): void; /** * @inheritdoc */ TYPE(): string; /** * @inheritdoc */ TAG(): string; /** * @inheritdoc */ toXML(): samchon.library.XML; } } declare namespace bws.packer { /** *

      Wrap represents an act wrap(ping).

      * *

      {@link Wrap} is a class represents an act wrapping an {@link Instance} to an {@link Wrapper}. * To represent the relationship, Wrap uses Bridge and Capsular patterns to links and intermediates * relationship between Wrapper and Instance.

      * *

      Wrap also helps packing optimization and 3d-visualization with its own members * {@link orientation} and position variables {@link x}, {@link y} and {@link z}.

      * * @author Jeongho Nam */ class Wrap extends samchon.protocol.Entity { /** * A wrapper wrapping the {@link instance}. */ protected wrapper: Wrapper; /** * An instance wrapped into the {@link wrapper}. */ protected instance: Instance; /** * Coordinate-X of the instance placement in the wrapper. */ protected x: number; /** * Coordinate-Y of the instance placement in the wrapper. */ protected y: number; /** * Coordinate-Z of the instance placement in the wrapper. */ protected z: number; /** * Placement orientation of wrapped {@link instance}. */ protected orientation: number; /** * */ protected color: number; /** * Construct from a Wrapper. * * @param wrapper A wrapper who will contain an instance. */ constructor(wrapper: Wrapper); /** * Construct from a Wrapper and Instance with its position and default orientation 1. * * @param wrapper A wrapper who contains the instance. * @param instance An instance contained into the wrapper. * @param x Coordinate-X of the {@link instance} placement in the {@link wrapper}. * @param y Coordinate-Y of the {@link instance} placement in the {@link wrapper}. * @param z Coordinate-Z of the {@link instance} placement in the {@link wrapper}. */ constructor(wrapper: Wrapper, instance: Instance, x: number, y: number, z: number); /** * Construct from a Wrapper and Instance with its position and orientation. * * @param wrapper A wrapper who contains the instance. * @param instance An instance contained into the wrapper. * @param x Coordinate-X of the {@link instance} placement in the {@link wrapper}. * @param y Coordinate-Y of the {@link instance} placement in the {@link wrapper}. * @param z Coordinate-Z of the {@link instance} placement in the {@link wrapper}. * @param orientation Placement orientation of wrapped {@link instance}. */ constructor(wrapper: Wrapper, instance: Instance, x: number, y: number, z: number, orientation: number); /** * @inheritdoc */ construct(xml: samchon.library.XML): void; /** * Factory method of wrapped Instance. * * @param type Type of contained Instance's type. */ protected createInstance(type: string): Instance; /** * Set orientation. * * @param orientation Orientation code (1 to 6). */ setOrientation(orientation: number): void; /** * Set position. * * @param x Coordinate-X of the instance placement in the wrapper. * @param y Coordinate-Y of the instance placement in the wrapper. * @param z Coordinate-Z of the instance placement in the wrapper. */ setPosition(x: number, y: number, z: number): void; /** * @brief Estimate orientation by given size. * * @param width Width by placement. * @param height Height by placement. * @param length Length by placement. */ estimateOrientation(width: number, height: number, length: number): void; /** * @brief Orientation change is occured in level of the packer. * * @details orientation Packer's new orientation. */ changeWrapperOrientation(orientation: number): void; /** * Get wrapper. */ getWrapper(): Wrapper; /** * Get instance. */ getInstance(): Instance; /** * Get x. */ getX(): number; /** * Get y. */ getY(): number; /** * Get z. */ getZ(): number; /** * Get orientation. */ getOrientation(): number; /** * Get width. */ getWidth(): number; /** * Get height. */ getHeight(): number; /** * Get length. */ getLength(): number; /** * Get volume. */ getVolume(): number; $instanceName: string; $layoutScale: string; $position: string; /** * @inheritdoc */ TAG(): string; /** * @inheritdoc */ toXML(): samchon.library.XML; /** * Thickness of boundary lines of a shape represents the {@link instance}. */ private static BOUNDARY_THICKNESS; /** * * * @param geometry * * @return A shape and its boundary lines as 3D-objects. */ toDisplayObjects(geometry: THREE.Geometry): std.Vector; } } declare namespace bws.packer { /** * A wrapper wrapping instances. * * @author Jeongho Nam */ class Wrapper extends samchon.protocol.EntityDeque implements Instance { /** *

      Name, key of the Wrapper.

      * *

      The name represents a type of Wrapper and identifies the Wrapper.

      */ protected name: string; /** * Price, cost of using an Wrapper. */ protected price: number; /** * Width of the Wrapper, length on the X-axis in 3D. */ protected width: number; /** * Height of the Wrapper, length on the Y-axis in 3D. */ protected height: number; /** * Length of the Wrapper, length on the Z-axis in 3D. */ protected length: number; /** *

      Thickness, margin of a Wrapper causes shrinkness of containable volume.

      * *

      The thickness reduces each dimension's containable size (dimension - 2*thickness), * so finally, it reduces total containable volume (-8 * thickness^3).

      */ protected thickness: number; /** * Default Constructor. */ constructor(); /** * Copy Constructor. */ constructor(wrapper: Wrapper); /** * Construct from members. * * @param name Name, identifier of a Wrapper. * @param price Price, issued cost for a type of the Wrapper. * @param width Width, dimensional length on the X-axis in 3D. * @param height Height, dimensional length on the Y-axis in 3D. * @param length Length, dimensional length on the Z-axis in 3D. * @param thickness A thickness causes shrinkness on containable volume. */ constructor(name: string, price: number, width: number, height: number, length: number, thickness: number); construct(xml: samchon.library.XML): void; /** * @inheritdoc */ createChild(xml: samchon.library.XML): Wrap; /** * Key of a Wrapper is its name. */ key(): any; /** * Get name. */ getName(): string; /** * Get price. */ getPrice(): number; /** * Get width, length on X-axis in 3D. */ getWidth(): number; /** * Get height, length on Y-axis in 3D. */ getHeight(): number; /** * Get length, length on Z-axis in 3D. */ getLength(): number; /** * Get thickness. */ getThickness(): number; /** *

      Get (calculate) containable width, length on the X-axis in 3D.

      * *

      Calculates containable width considering the {@link thickness}.

      * * @return width - (2 x thickness) */ getContainableWidth(): number; /** *

      Get (calculate) containable height, length on the Y-axis in 3D.

      * *

      Calculates containable height considering the {@link thickness}.

      * * @return height - (2 x thickness) */ getContainableHeight(): number; /** *

      Get (calculate) containable length, length on the Z-axis in 3D.

      * *

      Calculates containable length considering the {@link thickness}.

      * * @return length - (2 x thickness) */ getContainableLength(): number; /** *

      Get (calculate) volume.

      * *

      Notice

      *

      If {@link thickness} of the Wrapper is not 0, the volume does not mean containable volume. * In that case, use {@link containableVolume} instead.

      * * @return width x height x length */ getVolume(): number; /** *

      Get (calculate) containable volume.

      * *

      Calculates containable volume considering the {@link thickness}.

      * * @return volume - {(2 x thickness) ^ 3} */ getContainableVolume(): number; /** * Get utilization ratio of containable volume. * * @return utilization ratio. */ getUtilization(): number; equal_to(obj: Wrapper): boolean; /** *

      Wrapper is enough greater?

      * *

      Test whether the Wrapper is enough greater than an Instance to contain.

      * * @param instance An Instance to test. * @return Enough greater or not. */ containable(instance: Instance): boolean; /** * @inheritdoc */ setName(val: string): void; /** * Set price. */ setPrice(val: number): void; /** * @inheritdoc */ setWidth(val: number): void; /** * @inheritdoc */ setHeight(val: number): void; /** * @inheritdoc */ setLength(val: number): void; /** * Set thickness. */ setThickness(val: number): void; $name: string; $price: string; $width: string; $height: string; $length: string; $thickness: string; $scale: string; $spaceUtilization: string; /** * @inheritdoc */ TYPE(): string; /** * @inheritdoc */ TAG(): string; /** * @inheritdoc */ CHILD_TAG(): string; /** * @inheritdoc */ toXML(): samchon.library.XML; private static scene; private static renderer; private static camera; private static trackball; private static mouse; private static BOUNDARY_THICKNESS; /** *

      Convert to a canvas containing 3D elements.

      * * @param endIndex * * @return A 3D-canvans printing the Wrapper and its children {@link Wrap wrapped} * {@link Instance instances} with those boundary lines. */ toCanvas(endIndex?: number): HTMLCanvasElement; private static handleMouseMove(event); private static animate(); private static render(); } } declare namespace bws.packer { /** * A group of {@link Wrapper Wrappers} with same type. * * @author Jeongho Nam */ class WrapperGroup extends WrapperArray { /** *

      A sample, standard of the WrapperGroup.

      * *

      The sample represents what type of Wrappers are grouped into the WrapperGroup.

      */ protected sample: Wrapper; /** * Allocated instances. */ protected allocatedInstanceArray: InstanceArray; /** * Default Constructor. */ constructor(); /** * Copy Constructor. */ constructor(wrapperGroup: WrapperGroup); /** * Construct from a sample. * * @param sample A sample, standard of the WrapperGroup. */ constructor(sample: Wrapper); /** * Construct from members of the {@link sample}. * * @param name Name, identifier of the sample. * @param price Price, issued cost for a type of the sample. * @param width Width, dimensional length on the X-axis in 3D, of the sample. * @param height Height, dimensional length on the Y-axis in 3D, of the sample. * @param length Length, dimensional length on the Z-axis in 3D, of the sample. * @param thickness A thickness, causes shrinkness on containable volume, of the sample. */ constructor(name: string, price: number, width: number, height: number, length: number, thickness: number); /** * Key of a WrapperGroup is dependent on its sample. */ key(): any; /** * Get sample. */ getSample(): Wrapper; /** * Get allocated instances. */ getAllocatedInstanceArray(): InstanceArray; /** * Get (calculate) price. * * @return (Price of the sample) x (numbers of children Wrappers) */ getPrice(): number; /** * @inheritdoc */ getUtilization(): number; /** *

      Allocate instance(s) to the WrapperGroup.

      * *

      Inspect the instance is enough small to be wrapped into an empty wrapper. If the instance * is enough small, registers the instance (or repeated instances) to the {@link reserveds} and * returns true. If the instance is too large to be capsuled, returns false.

      * *

      Note

      *

      The word the instance is enough small to be wrapped into the empty wrapper means * the instance can be contained into an empty, a new wrapper contaning nothing literally.

      * *

      In the method allocate(), it doesn't consider how many instances are wrapped into ordinary * wrapper and how much volumes are consumed.

      * * @param instance An Instance to allocate. * @param n Repeating number of the instance. * * @return Whether the instance is enough small to be wrapped into a (new) wrapper * of same type with the sample. */ allocate(instance: Instance, n?: number): boolean; /** *

      Run optimization in level of the group.

      * *

      The optimization routine begins by creating a {@link Wrapper} like the {@link sample}. Then * try to pack {@link allocatedInstanceArray allocated instances} to the {@link Wrapper} as a lot as * possible. If there're some {@link Wrappers} can't be packed by overloading, then create a new * {@link Wrapper} again and try to pack {@link allocatedInstanceArray instances} again, too.

      * *

      Repeats those steps until all {@link alloctedInstanceArray instances} are {@link Wrap packed} * so that there's not any {@link Instance instance} left.

      * *

      Warning

      *

      When call this {@link optimize optimize()} method, ordinary children {@link Wrapper} objects * in the {@link WrapperGroup} will be substituted with the newly optimized {@link Wrapper} objects.

      */ optimize(): void; /** *

      Wrap allocated instances into a new {@link Wrapper}.

      * *

      {@link Wrap Wraps} instances to a new Wrapper which is copied from the sample.

      *

      After the wrapping is done, the new {@link Wrapper} is registered to the {@link WrapperGroup} * as a child and instances failed to wrap by overloading is returned.

      * * @param instanceArray instances to {@link Wrap wrap} into a new {@link Wrapper}. * * @return Instances failed to {@link Wrap wrap} by overloading. * @see boxologic */ private pack(instanceArray); /** * @inheritdoc */ TAG(): string; } } declare namespace bws.packer { abstract class Editor extends React.Component<{ dataProvider: samchon.protocol.EntityArrayCollection; }, {}> { private columns; private selected_index; /** * Default Constructor. */ constructor(); protected abstract createColumns(): AdazzleReactDataGrid.Column[]; private get_row(index); private insert_instance(event); private erase_instances(event); private handle_data_change(event); private handle_row_change(event); private handle_select(event); render(): JSX.Element; } } declare namespace bws.packer { interface ItemEditorProps extends React.Props { application: PackerApplication; instances: InstanceFormArray; wrappers: WrapperArray; } class ItemEditor extends React.Component { private clear(event); private open(event); private save(event); private pack(event); render(): JSX.Element; } class InstanceEditor extends Editor { protected createColumns(): AdazzleReactDataGrid.Column[]; } class WrapperEditor extends Editor { protected createColumns(): AdazzleReactDataGrid.Column[]; } } declare namespace bws.packer { class PackerApplication extends React.Component<{}, {}> { private instances; private wrappers; private result; /** * Default Constructor. */ constructor(); pack(): void; drawWrapper(wrapper: Wrapper, index?: number): void; render(): JSX.Element; static main(): void; } } declare namespace bws.packer { class ResultViewer extends React.Component { drawWrapper(wrapper: Wrapper, index?: number): void; private clear(event); private open(event); private save(event); refresh(): void; render(): JSX.Element; } interface WrapperViewerProps extends React.Props { application: PackerApplication; wrappers: WrapperArray; } }