{"id":27106160,"url":"https://github.com/whitegreen/dalsoo-bin-packing","last_synced_at":"2025-10-15T22:20:53.604Z","repository":{"id":84335931,"uuid":"155510566","full_name":"whitegreen/Dalsoo-Bin-Packing","owner":"whitegreen","description":"Bin packing places a given set of polygons in standard single/multiple rectangular sheet(s), to minimize the use of the sheet(s).","archived":false,"fork":false,"pushed_at":"2023-02-08T02:50:56.000Z","size":1253,"stargazers_count":58,"open_issues_count":1,"forks_count":11,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-06T19:40:24.915Z","etag":null,"topics":["bin-packing","cutting-stock","packing-algorithm","polygon"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/whitegreen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-31T06:37:47.000Z","updated_at":"2025-01-16T12:43:00.000Z","dependencies_parsed_at":"2023-03-10T23:30:17.921Z","dependency_job_id":null,"html_url":"https://github.com/whitegreen/Dalsoo-Bin-Packing","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/whitegreen/Dalsoo-Bin-Packing","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whitegreen%2FDalsoo-Bin-Packing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whitegreen%2FDalsoo-Bin-Packing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whitegreen%2FDalsoo-Bin-Packing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whitegreen%2FDalsoo-Bin-Packing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/whitegreen","download_url":"https://codeload.github.com/whitegreen/Dalsoo-Bin-Packing/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whitegreen%2FDalsoo-Bin-Packing/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279121812,"owners_count":26108305,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-15T02:00:07.814Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bin-packing","cutting-stock","packing-algorithm","polygon"],"created_at":"2025-04-06T19:36:57.065Z","updated_at":"2025-10-15T22:20:53.599Z","avatar_url":"https://github.com/whitegreen.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dalsoo-Bin-Packing\n\nA java library for 2D irregular shape packing in rectangular sheets. Algorithms are adapted from papers of Abeysooriya 2018 and Dalalah 2014. Bin packing places a given set of polygons in standard single/multiple rectangular sheet(s), to minimize the use of the sheet(s).\n\nThis library does not involve other libraries, however, the example uses core.jar (https://processing.org) for a graphical interface. The algorithm is effective when the ratio  (number of polygons / number of the types of polygons) is small.\n\nThe processing user needs to create “…/libraries/dalsoo/library/dalsoo.jar”, and then write “import pack.*;” to import the library.\n\n\n![alt text](multiple.png \"240 pieces of polygons are packed on 14 sheets within 27 seconds.\")\n\n\n## 1. Input \n\n**a**. Only simple polygon: no holes, no self-intersection.\n\n**b**. Data structure: point - double[];  polygon - double[][]; all polygons - double[][][]. \nOne might use other library to convert  other formats (e.g., dxf, obj) of polygon to double[][].\n\n**c**. It's better to represent a polygon with a moderate number of points. \nToo many points (e.g. a local detail contains dozens of points) slows down the algorithm. Avoid using too many points for a smooth curve.\nOne might use *segment_max_length* to let the algorithm create more points on a long straight edge of a polygon, if the polygon has very few points or the edge is very long.\n\n\n\n## 2. Choose an algorithm\n\n**a**. *useAbey*=true, *Jostle heuristics for the 2D-irregular shapes bin packing problems with free rotation, R. P. Abeysooriya et al. 2018*. However, Jostle method is not used.\n\n*rotSteps*:  Each polygon is rotated in the layout. Few steps (say 16) -\u003e run fast  \u0026 poor result;  many steps (say 48) -\u003e run slow \u0026 good results\n\n*segment_max_length*: if (an edge of a polygon \u003e segment_max_length),  breaks it into smaller segments. \nlarge value -\u003e run fast  \u0026 poor result; small value -\u003e run slow \u0026 good results\n\n*segment_max_length* is related to translation steps.\n\n**b**. *useAbey*=false, *Waste minimization in irregular stock cutting, D. Dalalah et al. 2014*\n\nthe rotation/translation steps depend on the polygons.\n\n\n\n## 3. Output options\n\n**a**. obtain the transformation of each polygon in the final layout, including:\n\nint[] *result_pack_id*;  // result_pack_id[8]=2 means the 9th polygon is on the 3rd sheet.\n\ndouble[][] *result_cos_sin*; // result_cos_sin[8]={0.5, 0.866} means the 9th polygon is rotated 60 degree around (0,0).\n\ndouble[][] *result_position*; // result_position[8]={7.4, 9.0} means that the 9th polygon should be translated by (7,4, 9.4) after rotation.\n\n**b**. obtain the geometry of each polygon in the final layout \n\nPack pack = packs.get(id);   //obtain a sheet (pack) by id.\n\nfor (Strip strip : pack.fixs) { // obtain a placed strip (polygon) in a sheet.\n\nstrip.inps // the polygon's points, one might use other library to convert double[][] to other formats (e.g., dxf: https://github.com/whitegreen/DXF-Laser) of polygon \n\n}\n\n![alt text](single.png \"The original polygon is marked in black, the margin(offset) in red. The convex of all polygons in one sheet is in green.\")\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhitegreen%2Fdalsoo-bin-packing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwhitegreen%2Fdalsoo-bin-packing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhitegreen%2Fdalsoo-bin-packing/lists"}