Method Pack
- Namespace
- GeometryHelper.Packing
- Assembly
- GeometryHelper.dll
Pack(IReadOnlyList<GeoRectangle2[]>, Sheet)
Packs the boxes onto sheets like the one given, with the default options.
public static PackResult Pack(IReadOnlyList<GeoRectangle2[]> groups, Sheet sheet)
Parameters
groupsIReadOnlyList<GeoRectangle2[]>The boxes, in groups of those that belong together. A null group is passed over.
sheetSheetThe sheet: its size, scale, offsets, where it lies, and where each new one goes.
Returns
- PackResult
Where each box goes, in the shape the boxes were given, and the sheets they took.
Exceptions
- ArgumentNullException
groupsorsheetis null.- ArgumentException
The offsets of the sheet leave it no room.
Pack(IReadOnlyList<GeoRectangle2[]>, Sheet, PackOptions)
Packs the boxes onto sheets like the one given.
public static PackResult Pack(IReadOnlyList<GeoRectangle2[]> groups, Sheet sheet, PackOptions options)
Parameters
groupsIReadOnlyList<GeoRectangle2[]>The boxes, in groups of those that belong together. A null group is passed over.
sheetSheetThe sheet: its size, scale, offsets, where it lies, and where each new one goes.
optionsPackOptionsThe gaps, how a group is laid out, the order the groups go in, and the tolerance.
Returns
- PackResult
Where each box goes, in the shape the boxes were given, and the sheets they took.
Exceptions
- ArgumentNullException
groups,sheetoroptionsis null.- ArgumentException
The offsets of the sheet leave it no room.
Pack(IReadOnlyList<GeoPolygon2[]>, Sheet)
Packs the polygons onto sheets like the one given, by their own shape, with the default options.
public static PackResult Pack(IReadOnlyList<GeoPolygon2[]> groups, Sheet sheet)
Parameters
groupsIReadOnlyList<GeoPolygon2[]>The polygons, in groups of those that belong together: views cut to a polygon, an L or a U among them. A null group is passed over.
sheetSheetThe sheet: its size, scale, offsets, where it lies, and where each new one goes.
Returns
- PackResult
Where each polygon goes, in the shape the polygons were given, and the sheets they took.
Remarks
Exceptions
- ArgumentNullException
groupsorsheetis null.- ArgumentException
The offsets of the sheet leave it no room; or a polygon is null, not at finite coordinates, encloses no area, or crosses itself.
Pack(IReadOnlyList<GeoPolygon2[]>, Sheet, PackOptions)
Packs the polygons onto sheets like the one given, by their own shape: a polygon with a notch lets another stand in it.
public static PackResult Pack(IReadOnlyList<GeoPolygon2[]> groups, Sheet sheet, PackOptions options)
Parameters
groupsIReadOnlyList<GeoPolygon2[]>The polygons, in groups of those that belong together: views cut to a polygon, an L or a U among them. A null group is passed over.
sheetSheetThe sheet: its size, scale, offsets, where it lies, and where each new one goes.
optionsPackOptionsThe gaps, how a group is laid out, the order the groups go in, and the tolerance.
Returns
- PackResult
Where each polygon goes, in the shape the polygons were given, and the sheets they took: ViewPolygon is the polygon moved and ViewBox the box round it.
Remarks
The polygons are only moved, never turned or resized, and they are packed by their true shape, not by the box round it. The places a polygon may stand are those where it stays inside the usable area of the sheet and clear of the polygons already there, found from the no-fit polygon of each pair, so that an L-shaped view lets a small one stand in its notch. Each is put where its top is highest and then its left side furthest left, as Pack(IReadOnlyList<GeoRectangle2[]>, Sheet, PackOptions) puts a box. From another StartCorner the packing is the mirror image of that one, the polygons as they are given taken to the mirror image of the places: the same views, mirrored across the sheet, would pack the same.
Spacing is the least gap between two polygons of one group and GroupSpacing between two groups, measured between the polygons themselves, not their boxes. A group laid out afresh (Compact) is packed together first, in its order from the start corner, as close together as it goes, and goes onto the sheet as one block; a group kept as drawn (Keep) moves as one block with its polygons as they stand, overlapping or not. A block is placed by the shape of each of its polygons, so that polygons of another group may stand between them, in a notch, as long as the group spacing is kept. A group too large for one sheet is split, in its order, into blocks that each go onto one.
A polygon larger than the usable area of a sheet is not placed. The result is judged as it came out: a polygon reported Placed lies inside the usable area of its sheet and clear of every other, the gaps kept, but the polygons of a kept group; the tolerance of the options is how far it may pass either. The same polygons and options give the same result, and the polygons, the sheet and the options are only read. A polygon takes time with the number of polygons already on its sheet and the corners of each: 200 polygons of up to a fifth of an A1 take a few seconds.
Exceptions
- ArgumentNullException
groups,sheetoroptionsis null.- ArgumentException
The offsets of the sheet leave it no room; or a polygon is null, not at finite coordinates, encloses no area (its area is no more than the tolerance squared), or crosses itself.