Questions tagged [packing]

Use this tag for questions related to packing, which can extend from struct packing to grouping elements together.

In C, will prevent the compiler from adding padding to a struct, which will save some memory, but may affect access speed to the members of the struct (since it may not memory-aligned).

However, has a general meaning as well, when you want to group/cluster similar elements together.

347 questions
5
votes
5 answers

Packing Rectangles Algorithm

I need to solve the following problem: I have multiple rectangles of sizes: width height, width/2 height/2, width/4 height/4 , width/8 height/8 ... etc I need to pack these rectangles in a big rectangle of size x*width y*height such that no…
silviupop
  • 638
  • 7
  • 14
5
votes
1 answer

Algorithm to optimally fit a sphere between other spheres in a 3D bounding box?

I'm struggling with a 3D problem for which I'm trying to find an efficient algorithm. I have a bounding box with given width, height, and depth. I also have a list of spheres. That is, a center coordinate (xi,yi,zi) and radius ri for each…
RocketNuts
  • 9,958
  • 11
  • 47
  • 88
5
votes
4 answers

fitting n variable height images into 3 (similar length) column layout

I'm looking to make a 3-column layout similar to that of piccsy.com. Given a number of images of the same width but varying height, what is a algorithm to order them so that the difference in column lengths is minimal? Ideally in Python or…
Hoff
  • 38,776
  • 17
  • 74
  • 99
5
votes
3 answers

More interactive ZODB packing

Current ZMI management "Pack database" functionality is little rough. 1) Could it be possible to have some kind of progress indicator for web UI? E.g. one telling how many minutes/hours are left giving at least some kind of estimate 2) How does ZODB…
Mikko Ohtamaa
  • 82,057
  • 50
  • 264
  • 435
5
votes
2 answers

What's an elegant algorithm for fitting differently sized rectangles into a circle?

I have a bunch of rectangles of variable size which I need to fit together roughly into a circle, presumably with the largest ones at the center. NB. The circle is not of a fixed size - that's just the overall shape I'm after. This is more like how…
Long Ears
  • 4,886
  • 1
  • 21
  • 16
5
votes
1 answer

Anybody have experience reading ISOBUS (ISO 11783-10) binary timelog files?

I am trying to open and read a bunch of geo-referenced timelog files that are in binary format. They supposedly follow the ISO-11783 (ISOBUS) standard for agricultural machinery, but after reading 100s of pages of the standard I cannot figure out…
hullflyer
  • 157
  • 7
5
votes
2 answers

C++ Specify Actual Size of Struct

I've come across a problem with interop between C# and C++ where I'm sharing memory between the two 'sides' of my application via a struct defined in both native and managed code. The struct on the native side is defined as such: #pragma pack(push,…
Xenoprimate
  • 7,691
  • 15
  • 58
  • 95
5
votes
3 answers

binary16 in Python

The struct module is useful when you're trying to convert data to and from binary formats. However, recently I came across a file format specification that uses the binary16 floating point format. I looked through the Python documentation, but can't…
icktoofay
  • 126,289
  • 21
  • 250
  • 231
5
votes
7 answers

C++ packing a typedef enum

typedef enum BeNeLux { BELGIUM, NETHERLANDS, LUXEMBURG } _ASSOCIATIONS_ BeNeLux; When I try to compile this with C++ Compiler, I am getting errors, but it seems to work fine with a C compiler. So here's the question. Is it possible to pack…
Sagar
  • 9,456
  • 6
  • 54
  • 96
5
votes
0 answers

Python a comparison of the distributions?

Does anyone have/know of a list that compares all the python distributions with their packages? I have been looking for a kind of one shot installation method for locked down networks, where I don't want to call the administrator every month to…
CromeX
  • 445
  • 1
  • 7
  • 20
5
votes
2 answers

Reverse Rectangle Packing

I have a connected shape that consists of squares put together, e.g. take a squared paper and draw a line along the existing lines that ends at its beginning and does not cross itself. The goal is now to find an algorithm (not brute-force) that…
aZen
  • 223
  • 1
  • 8
4
votes
4 answers

How is the organization of the 12 Bit RGB color format?

I know that the 12 bit RGB color pallette format , has 4 bit for each color R,G,B. But how is the structure of the raw data i.e. 1.) Does each color have a byte corresponding to it which in turn has 4 padding bits , and 4 data bits for color data…
goldenmean
  • 18,376
  • 54
  • 154
  • 211
4
votes
1 answer

How to spread boxes on into another box in non-iterative manner?

So I have boxes of different sizes (squares). I have a Big Box (not a square). I have no guarantee that all of my boxes will fit, yet I need to try to fit as much as possible in a non-iterative manner without overlap. What algorithm allows for such…
DuckQueen
  • 772
  • 10
  • 62
  • 134
4
votes
2 answers

kkrunchy - how to get rid of the tls data in a Delphi executable?

Just for fun and giggles I'm trying to create a 64k intro in delphi. One of the best executable packers for applications of this size is kkrunchy by Farbrausch. However, when I run it on an (otherwise empty) Delphi executable, I get the following…
Paul-Jan
  • 16,746
  • 1
  • 63
  • 95
4
votes
3 answers

multiple null terminated strings in single buffer in C

In need to craft a string with the following format and place it into a single buffer[1000]. Note that \x00 is the null terminator.…