# Questions tagged [packing]

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

321
questions

**0**

votes

**0**answers

31 views

### Algorithm to pack N rectangles into a larger one

I am writing a (JavaScript) thumbnail generator and this bit of the project involves placing the N thumbnails in regular rows and columns within a larger target space, including a border around the ...

**0**

votes

**1**answer

41 views

+50

### Justified Packing of Rectangles in Javascript

I have an algorithm that packs a set of rectangles. My problem is that all of the rectangles end up perfectly aligned on the let side of the canvas (outlined in red), but not on the right side of the ...

**0**

votes

**0**answers

8 views

### Faild with errorcode 5 Ue 4 24 all builds

Other project with same ue engine (from source) works fine.
Problem comes with :
cl : Command line error D8022 : cannot open
I check file Module.GeometryCollectionSimulationCore.gen.cpp.txt.tmp it is ...

**3**

votes

**2**answers

155 views

### How do you pack three 4 bit signed integers (so 5 bits) into a single 16 bit integer?

I want to pack 3 signed 4 bit integers (4 bits data, 1 bit sign bit) into one 16 bit integer, but I have no idea how to do it or where to start :(
I need this to represent a position in a 3D grid in ...

**1**

vote

**2**answers

63 views

### java.io.UTFDataFormatException while reading file entry name

Im trying to "pack" several files (previously inside a jar archive) in another single non-jar file by using DataInputStream / DataOutputStream.
The idea was:
First int = number of ...

**0**

votes

**0**answers

22 views

### Algorithm for maximum area coverage where overlap is allowed

I am trying to solve a problem in which I want to maximise the area covered by a circular sensor node within a simple rectangle. I want to be able to input the amount of nodes and then have the ...

**0**

votes

**0**answers

55 views

### Is there an algorithm or custom function to pack objects / items so that they form a square or a rectangle shape (approximately) efficiently?

Is there an algorithm or custom function(in js) to pack objects / items (with the following dimensions: width, height, length) so that they form a square or a rectangle, occupying space efficiently? ...

**-1**

votes

**1**answer

50 views

### How can I pack files inside Assets in Unity to reduce the quantity?

I work with unity game projects with thousands of models and other resources inside the Assets folder. After a while, this becomes too slow and inconvenient, due to the constant refresh and meta files....

**3**

votes

**2**answers

175 views

### How to fill a fixed rectangle with square pieces entirely?

Is this knapsack algorithm or bin packing? I couldn't find an exact solution but basically I have a fixed rectangle area that I want to fill with perfect squares that represents my items where each ...

**0**

votes

**0**answers

39 views

### Show price in the packing slip - Shopify

I was using a good coding to show the price for each product in the packing slip to print on Shopify. The code that I was using is this https://community.shopify.com/c/Shopify-Design/show-item-prices-...

**0**

votes

**1**answer

179 views

### how to unpack/decompress raw grpc data?

i intercepted grpc http2 request yet i cant make much sense of the data mitmproxy is printing it as hex this is some of the headers
te: trailers
content-type: application/grpc
grpc-accept-encoding: ...

**0**

votes

**1**answer

171 views

### Generating random points in a box

I want to generate random points in a box (a=0.2m, b=0.2m, c=1m). This points should have random distance between each other but minimum distance between two points is should be 0.03m, for this I used ...

**0**

votes

**1**answer

63 views

### Generating rows of combinations

I don't know how I should formulate this question but I hope I can explain what I want to achive.
So I got a set of characters [A, B, C].
I want to generate the minimal amount of rows with length of N ...

**2**

votes

**1**answer

79 views

### Advantage of using MPI_PACK()

I know that MPI_PACK() is used to bundle the non-contiguous data together and send them, but what is the use of it, rather then sending data using MPI_Send() one after the other?

**0**

votes

**0**answers

93 views

### Packing Triangles into Rectangle

I am trying to create an algorithm that will pack regular and irregular triangles of varying sizes into rectangles of a given size in the most efficient way possible. I am trying to generate diagrams ...

**-1**

votes

**2**answers

36 views

### Unexpected value after type casting in c

I was implementing the code for sending data through a raw socket. As part of that, I have to construct an IP packet. But I am facing the problem as explained below using a sample program.
#include &...

**0**

votes

**1**answer

39 views

### How to extract non-function code from module?

I'm trying to extract all the "runnable" code given a function in a module. Right now I'm only able to extract the functions in any imported module that are called inside the starting ...

**0**

votes

**1**answer

53 views

### C++ Struct packing order

I have a union that looks similar to the following:
typedef
union _thing
{
struct thing_indiv {
uint16_t one:5;
uint16_t two:4;
uint16_t three:5;
uint16_t four:5;
...

**0**

votes

**0**answers

60 views

### Fit rectangles in a larger rectangle in JavaScript/React

I am creating a function that is able to calculate how many small rectangles can be fit into a container one. The problem that I'm stuck with - not quite sure how to proceed with the calculations.
The ...

**1**

vote

**1**answer

188 views

### Algorithm for 3D Bin Packing Problem on pallet

I am looking for algorithm for 3D Bin Packing Problem. My task is:
I have a conveyor on which I am receiving boxes of 4 sizes (300x200x160, 400x300x220, 600x400x340, 700x510x340). These boxes have to ...

**0**

votes

**2**answers

85 views

### How to make it one-liner? Convert list to a bunch of parameters

I have the following code:
from datetime import datetime
ds = "2020.10.10.12.30.59"
y, M, d, h, m, s = [int(x) for x in ds.split('.')]
dt = datetime(y, M, d, h, m, s)
print(dt)
I would ...

**1**

vote

**3**answers

55 views

### Is there a reason for unpacking a list then putting it back into a list?

I'm trying to understand the following Python line:
result = {'key_A': [*dict_A.keys()], 'key_B': "dummy_string"}
Result is dictionary that holds a list in Result['key_A'] and string in ...

**0**

votes

**1**answer

80 views

### C/C++ How Nested Structures Are Packed?

If a word is 4 bytes on my architecture, I would expect the following structure to be padded in order to be at least a word (4 bytes) in size.
// 4 bytes
struct
{
uint8_t High : 4;
uint8_t Low : 4;...

**2**

votes

**1**answer

242 views

### Converting float list to byte-like object results in a corrupted image

I am trying to convert data from a Keysight scope to .png Image.
When I looked how to do it online, I stumbled the following code:
# Download the screen image.
# ---------------------------------------...

**0**

votes

**1**answer

45 views

### How to get rid of installing OpenCV in Ubuntu which is needed by SikuliX API

I have bundled the SikuliX 2.0.3 Jar in my java application. At run-time, this jar file needs access to the OpenCV library from java.library.path. So, I need to install OpenCV on the library path (/...

**1**

vote

**4**answers

74 views

### python-how to pass dictionaries as inputs in function without repeating the elements in dictionary

How I can pass the dictionaries as an input of a function without repeating the elements in function?
please see a simplified example below:
def myfuction(a,b,c):
aa = b/2
y = a+b+c+aa
...

**0**

votes

**2**answers

1k views

### How to unpack uint32_t colour in c++

I currently have a uint32_t variable that stores the rgb colours of a pixel.
It looks like:
uint32_t colour = (255<<24) + (int(red)<<16) + (int(green)<<8) + int(blue);
where the ...

**0**

votes

**0**answers

102 views

### C GTK - ProgressBar not acting as expected

I'm trying to to show the current percentage of the progressbar inside the progressbar, which should be possible using GTK, however when I set the text value it shows above the progressbar instead of ...

**3**

votes

**2**answers

133 views

### Pack/unpack array of 64 bools into a uint64

I've come across this answer.
But I hit 2 issues, I'm not sure how to adapt it to pack 64 bits (see below), and I can't get my head around unpacking them.
Here is what I have for packing:
const int ...

**0**

votes

**1**answer

510 views

### JPackage copy files to the Resource folder of app before the DMG is created

I am using JPackage from Java 14 on MacOS and need to copy files to the MacOS and Resources folders of the app prior to building the DMG but do not see how. In the Packaging Tool User's Guide it ...

**0**

votes

**0**answers

200 views

### Simple implementation of 2D rectangle packing in Java

I have been searching for a 2D-packing algorithm that I can use for my program:
Imagine I have a big wooden plate and smaller plates to cut from this big plate. I know the size of the big plate and ...

**0**

votes

**1**answer

81 views

### maven-shade-plugin won't include dependencies

I have an infuriating problem. I am trying to use maven-shade-plugin to pack my spring mvc app with an embedded tomcat server into a single jar. I've already tried a similar task. Tried to use a ...

**0**

votes

**0**answers

59 views

### passing arguments to a function via * or **

there are (say) two functions, norm and uniform, both of which take the arguments scale and loc.
I would like to have a function called pick_a_distribution, which selects which distribution to pick ...

**1**

vote

**2**answers

227 views

### How to distribute rectangles with minimum overlap

Basically I need to distribute various rectangles in a bigger rectangle randomly. So:
While there is enough space, rectangles don't overlap or overlap just a bit.
When there is not enough space ...

**4**

votes

**1**answer

164 views

### 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 ...

**0**

votes

**1**answer

346 views

### Maximum number of non-overlapping spheres covering a sphere?

I would like to know if there is a formula, or at least some bounds, for the following problem. Consider a (three-dimensional) sphere of radius R. What is the maximum number of equal spheres, all of ...

**1**

vote

**1**answer

1k views

### Packing rectangles in a rectangle, generate grids coordinates

Looking to generate some randoms grids of rectangles in a bigger rectangle.
This looks like a fairly easy problem, but it's not, seeking for advises here.
This is not a packing problem, since the ...

**0**

votes

**1**answer

70 views

### Main function body doesn't detect call to overloaded variadic-templated function C++

I'm currently learning variadic template functions and parameter packing/unpacking.
This is my code,
template<typename T, typename U>
void my_insert(std::vector<int>& v, T& t) {...

**0**

votes

**0**answers

63 views

### Hexagonal packaging of spheres inside the cylinder

I have some cylinder of radius R and spheres of radius r. I try to find an algorithm on how to pack these spheres inside the cylinder hexagonally. I guess that it should be solved a thousand times, ...

**0**

votes

**1**answer

151 views

### Simple circle packing problem with circles of different size

Is there an analytical solution to find the intersection point between the placed grain and grain 1 if the placed grain is lowered [in the reference frame of the image] along the dotted line? We know ...

**0**

votes

**0**answers

43 views

### structure packing and performance penalty

struct struct_s { char a; int b; };
I want to ask how packing a structure to 1 byte aligned into 32 bit machine result into speed reduction while reading and writing it. As i know structure packing ...

**4**

votes

**1**answer

235 views

### 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 ...

**-1**

votes

**1**answer

395 views

### Hexagon packing algorithm [closed]

I'm trying to pack hexagons, within bigger hexagons, as shown here:
For this example, I have 5 "children" to put in my "father" hexagon.
Each time I've got too many children, I would like to reduce ...

**1**

vote

**1**answer

110 views

### How to set the installed(who is installing the RPM) user and group privileges while packing the RPM

I am just wondering if there is a way to specify the current user(who
is installing the RPM) user:group privileges to installed folder of
RPM(/usr/lib/appfloder) in the Spec(.spec) file.
Example: ...

**0**

votes

**1**answer

52 views

### How to add the prerequisite package to be installed with RPM installation while packaging the RPM

I am creating a RPM package(ex test.RPM) which has a dependency of nss tools.
because my test.RPM application adds CA certificate to Chromum\firefox browsers to trust my self signed certificate.So i ...

**0**

votes

**1**answer

127 views

### Compute dimensions (bounding box) of packing algorithm result

I'm using this binary pack code. I'm using its GrowingPacker approach. It works fine, but I have a hard time figuring out the dimensions of the final pack, I mean the bounding box of final result like ...

**0**

votes

**3**answers

517 views

### Bit fields maked more optimized

I'm making some code for a 16 bits microprocessor. My memory is quite limited at 128 KB. IAR C/C++ Compiler for MSP430
I need to implement some code to save some memory.
I tried to implemented this ...

**1**

vote

**1**answer

54 views

### Packing problem : items into constrained bins (Solution to singular matrix)

EDIT: the way I have attempted to solve this with simultaneous equations may not actually work, any other approaches would be appreciated.
I have a set of containers, each with a maximum capacity n, ...

**-2**

votes

**3**answers

124 views

### Trying to create a word count function [duplicate]

I'm trying to create a function:
word_count("I do not like it Sam I Am")
gets back a dictionary like:
{'i': 2, 'do': 1, 'it': 1, 'sam': 1, 'like': 1, 'not': 1, 'am': 1}
I've no idea how to begin.

**-2**

votes

**1**answer

63 views

### How can I model the Circle packing problem with pyomo?

Circle packing problem in a circle container with minimal radius