When starting to write algorithm for 3d Container loading software
it is hard to understand how to utilize space while adding cargo to it. I give you my algorithm / structure of space utilization for 3d container packing software.
- Demo packing algorithm gives you a very good results and understanding about code usage.
- Algorithm based on Random and little bit of magic :) Unfortunately, each time it will give you different solution for the same problem.
- java3d library and Draw3d class gives you quick look / development tool for your algorithm results.
Notes:
-
Coordinates for
Bin
starts at (0,0,0
):[length, height, width
] and goes till defined bin size. -
Each time, when adding
Cargo
toBin
you have to createnew unmodifiable Bin
with added cargo to it (Example in demo algorithm). -
Core does not provide any restrictions when adding cargo, cargo can overlap, if not respected empty space.
-
Detailed info
- Run demo code.
- Explore demo algorithm: https://github.com/Strauteka/3d-bin-space-utilization/blob/main/demo/src/main/java/org/strauteka/jbin/demo/algorithm PackerEntry.java class
- Clone repository
- Compile:
mvn clean install
- Run Demo:
java -jar .\demo\target\demo-jar-with-dependencies.jar
- Java 1.8
- Maven
You may find solution in java3d folder ;)