This utility generates a watertight and orientable mesh over input 3D geometries via the CGAL library. This mesh is termed a "shrink wrap".
ShrinkWrap takes as inputs and outputs OBJ files, and maps materials if available.
A shrink wrap of one storey of an apartment building:
| Input | Output |
|---|---|
![]() |
![]() |
A shrink wrap from multiple inputs:
| Input 1 | Input 2 | Output |
|---|---|---|
![]() |
![]() |
![]() |
-
Create a conda environment with the necessary preqrequisites via the
environment.ymlfile:conda env create -f environment.yml conda activate shrink-wrap -
Build and compile the program:
cmake -S . -B ./build cmake --build ./build
./build/shrink_wrap data/input/Tembusu\ L12/ data/output/Tembusu\ L12 500.0 1.0
./build/shrink_wrap data/input/KPF\ Robinson\ Tower data/output/KPF\ Robinson\ Tower 0.5 0.001
| Name | Type | Description |
|---|---|---|
input |
std::string |
Directory that contains OBJ meshes to be shrink wrapped |
out |
std::string |
Target name of the OBJ and MTL shrink wrap files |
alpha |
double |
Alpha parameter (see CGAL 3D Alpha Wrapping), must be greater than 0.0 |
offset |
double |
Offset parameter (see CGAL 3D Alpha Wrapping), must be greater than 0.0 |
Install the latest JAR file from this repo's releases.
-
Build a JAR file with Docker:
docker build . -f java/Dockerfile --output=. -
Install the package from the JAR file.
import io.github.ccheemeng.shrink_wrap.ShrinkWrap;
public class Main {
public static void main(String[] args) {
ShrinkWrap.shrinkWrap(
"data/input/Tembusu L12", "data/output/Tembusu L12", 500.0, 1.0
);
ShrinkWrap.shrinkWrap(
"data/input/KPF Robinson Tower",
"data/output/KPF Robinson Tower",
0.5,
0.001,
);
}
}
Install the latest wheel from this repo's releases:
pip install <wheel-file>
-
Build a Python wheel with Docker:
docker build . -f python/Dockerfile --output=. -
Install the package from the built wheel:
pip install <wheel-file>
import shrink_wrap
shrink_wrap.shrink_wrap(
"data/input/Tembusu L12", "data/output/Tembusu L12", 500.0, 1.0
)
shrink_wrap.shrink_wrap(
"data/input/KPF Robinson Tower",
"data/output/KPF Robinson Tower",
0.5,
0.001,
)




