Skip to content

alpinebuster/meshsdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub License GitHub Issues or Pull Requests GitHub Issues or Pull Requests

Front Page

MeshSDK

Advanced algorithms for 3D data processing

MeshSDK provides a robust foundation for 3D data processing, supporting all essential formats like point clouds, meshes, and volumes continuously generated by modern sensors. The powerful half-edge data structure ensures manifold compliance for precise, reliable mesh representation.

Multi-Language Support. Written in C++ with bindings for C, C#, and Python, our library integrates easily into AI pipelines and workflows.

High Performance. Internal benchmarks show up to 10x faster execution compared to alternative SDKs — especially in mesh boolean operations and simplification.

GPU-Accelerated Architecture. Built with speed and scalability in mind, MeshSDK supports GPU acceleration and CUDA for high-performance computing.

Cross-Platform Ready. The SDK runs on Windows, macOS, Linux, and WebAssembly, offering flexibility for any development environment.

Flexible Integration. Use the toolkit as a standalone engine with UI components, or integrate selected algorithms into existing applications with minimal dependencies.

Key Available Algorithms

  • 3D Boolean performs fast, highly optimized mesh- and voxel-based operations.
  • Mesh Repair eliminates self-intersections, fills holes, and removes degeneracies.
  • Mesh Offsetting controls surface thickness with multiple precise modes for 3D printing and machining.
  • Hole Filling fills flat and curved surfaces, connects or separates holes, and builds bridges.
  • Mesh Simplification optimizes mesh complexity while keeping details within set tolerance. We provide remeshing, and subdivision options as well.
  • Collision Detection verifies intersections between models for further operations.
  • Extensive File Format Support enables importing a wide range of file formats for meshes, point clouds, CT scans, polylines, distance maps, and G-code. Export functionalities—and support for color and texture data—are available for select formats, too.
  • Triangulation converts point clouds into meshes with accurate normal creation.
  • ICP precisely aligns meshes using point-to-point and point-to-plane transformations.
  • Segmentation performs semi-automatic segmentation based on curvature for meshes and voxels.
  • Deformation applies Laplacian, freeform, and relaxation smoothing for fine mesh adjustments.
  • Support of Distance Maps and Polylines allows to generate distance maps and iso-lines and performs projection and intersection.

Development

Clangd

Install Clang 20, 19, or old versions in Ubuntu 24.04 | 22.04.

wget https://apt.llvm.org/llvm.sh
chmod u+x llvm.sh
sudo ./llvm.sh 20

sudo mkdir -p /etc/apt/keyrings
sudo mv /etc/apt/trusted.gpg.d/apt.llvm.org.asc /etc/apt/keyrings/
# When file opens in terminal window, add following in between “deb” and “http://apt.llvm.org/…”:
# [arch=amd64 signed-by=/etc/apt/keyrings/apt.llvm.org.asc]
#   - arch=amd64, tells your OS type is amd64 (Intel/AMD). For non-Intel/AMD platform, run dpkg --print-architecture command tell OS type, and replace amd64 with the output. So far, arm64 and s390x are also supported
#   - signed-by=/path/to/key-file, specify the key file.
sudo nano /etc/apt/sources.list.d/archive_uri-http_apt_llvm_org_noble_*.list

sudo apt install clang-20 lldb-20 lld-20 clangd-20
# To install everything, use the command below instead:
sudo apt install clang-tidy-20 clang-format-20 clang-tools-20 llvm-20-dev lld-20 lldb-20 llvm-20-tools libomp-20-dev libc++-20-dev libc++abi-20-dev libclang-common-20-dev libclang-20-dev libclang-cpp20-dev liblldb-20-dev libunwind-20-dev

# If everything’s done successfully, just run clang-xx --version and/or locate clang-xx to verify.

Uninstall

To remove the repository added by the script, just open terminal and run command to remove the corresponding source file:

sudo rm /etc/apt/sources.list.d/archive_uri-http_apt_llvm_org_*.list

And, remove the repository key file via command:

sudo rm /etc/apt/trusted.gpg.d/apt.llvm.org.asc

To remove Clang packages (replace 20 accordingly), just run command:

sudo apt remove --autoremove clang-20 lldb-20 lld-20 clangd-20

Linux & MacOS

Install emscripten toolkit:

# Fetch the latest version of the emsdk (not needed the first time you clone)
git pull

# Download and install the latest SDK tools.
# ./emsdk install latest # ⚠️
./emsdk install 4.0.10

# Make the "latest" SDK "active" for the current user. (writes .emscripten file)
# ./emsdk activate latest # ⚠️
./emsdk activate latest

# Activate PATH and other environment variables in the current terminal
source ./emsdk_env.sh

Build source code:

git submodule update --init

./scripts/build_thirdparty.sh
./scripts/build_source.sh

Docker

`docker compose up --build meshsdk-emscripten-build`

`docker compose up meshsdk-emscripten-build`
`docker compose up meshsdk-emscripten-build -d`

`docker compose --profile singlethreaded up meshsdk-emscripten-build-singlethreaded`
`docker compose --profile wasm64 up meshsdk-emscripten-build-wasm64`

#
# To run custom build commands:
#
`docker compose exec meshsdk-emscripten-build bash`
`docker compose exec meshsdk-emscripten-build-singlethreaded bash`
`docker compose exec meshsdk-emscripten-build-wasm64 bash`

Windows (Desktop)

Prerequisites

  1. Git
  • Install Git to manage repositories and submodules, which is also required to install vcpkg.
  1. Visual Studio 2019 or 2022
  1. CUDA Toolkit
  • For Visual Studio 2019: Install CUDA v11.4
  • For Visual Studio 2022: Install CUDA v12.0 Choose the appropriate version based on your Visual Studio installation.
  1. vcpkg
  • To install vcpkg, follow these steps:
  1. Open a command prompt (CMD) or PowerShell window.
  2. Navigate to a directory where you want to install vcpkg:
cd C:\path\to\your\desired\directory
  1. Clone the vcpkg repository:
git clone https://github.com/microsoft/vcpkg.git
  1. Navigate to the vcpkg directory:
cd vcpkg
git checkout 2024.10.21

If you're using Visual Studio 2022, you can use the latest version of vcpkg:

git checkout 2025.04.09

The version 2024.10.21 is required only for compatibility with Visual Studio 2019. 5. Run the bootstrap script to build the vcpkg executable:

bootstrap-vcpkg.bat
  1. Integrate vcpkg with Visual Studio (requires Administrator access):
vcpkg integrate install

Learn more about vcpkg

Installing the local build

The following steps will require approximately 40 GB of disk space.

  1. Clone the Submodules:
git submodule update --init
# or
git submodule update --init --recursive
  1. (Optional) Speed Up with AWS CLI
  • Optionally, install AWS CLI v2 to speed up the process before using the Installation Script. Restart your terminal after installation.
  1. Install Third-Party Dependencies
  • Execute the following commands to run the third-party installation script:
cd vcpkg
..\meshsdk\thirdparty\install.bat
  • This script automates the installation of necessary third-party dependencies.
  1. Build and Run Visual Studio Solution
  • Open meshsdk/source/MeshSDK.sln in Visual Studio.
  • Build the solution and run the application.
  1. Build and Run CMake Project
  • Make sure you have the "C++ CMake tools for Windows" component installed.
  • Open meshsdk/CMakeLists.txt in Visual Studio (File - Open - CMake).
  • Build the project and run the application.

Python

Build mrbind from source code:

# At project's root dir
sudo ./scripts/mrbind/install_deps_ubuntu.sh
./scripts/mrbind/install_mrbind_ubuntu.sh 


make -f scripts/mrbind/generate.mk -B --trace FOR_WHEEL=1
# PYTHON_VERSIONS=$(cat scripts/mrbind-pybind11/python_versions.txt | xargs)
make -f scripts/mrbind/generate.mk -B --trace PYTHON_VERSIONS=3.11
make -f scripts/mrbind/generate.mk -B --trace FOR_WHEEL=1 PYTHON_VERSIONS=3.11
make shims -f scripts/mrbind/generate.mk -B --trace FOR_WHEEL=1 PYTHON_VERSIONS=3.11


# Create and fix wheel
python -m pip install patchelf
# This will generate the `meshsdk` wheel to `./scripts/wheel/meshsdk`
python ./scripts/wheel/build_wheel.py --version 'v0.0.1'
# Install the built `meshsdk`
cd  ./scripts/wheel/meshsdk
pip install .
# Check the installed `meshsdk`
pip list | grep meshsdk


# Publish
cd  ./scripts/wheel/meshsdk
pip install --upgrade build twine
python -m build

# [distutils]
# index-servers =
#     pypi
#     testpypi

# [pypi]
# username = __token__
# password = <u-token>
# [testpypi]
# username = __token__
# password = <u-token>
vi ~/.pyirc

# test
twine upload --repository testpypi dist/*
pip install -i https://test.pypi.org/simple meshsdk

# official
twine upload dist/*
pip install meshsdk

Run the generator on different platforms

  • On Windows: scripts\mrbind\generate_win.bat -B --trace from the VS developer command prompt (use the x64 Native one!).

    When generating the Python bindings, the current directory matters, as this will look for MeshSDK in ./source/x64/Release. Add VS_MODE=Debug at the end if you built MeshSDK in debug mode.

    The generate_win.bat file merely calls generate.mk (see below) inside of MSYS2 shell. You can use that directly if you want.

  • On Linux: make -f scripts/mrbind/generate.mk -B --trace

    This will look for MeshSDK in ./build/Release/bin. Pass MESHSDK_SHLIB_DIR=path/to/bin for a different directory.

  • On MacOS: Same as on Linux, but before running the command you must adjust the PATH. On Arm Macs: export PATH="/opt/homebrew/opt/make/libexec/gnubin:$PATH", and on x86 Macs /usr/local/... instead of /opt/homebrew/.... This adds the version of Make installed in Homebrew to PATH, because the default one is outdated. Confirm the version with make --version, it must be 4.x or newer.

Some common flags:

  • --trace — enable verbose logs.

  • -B — force a full rebuild of the bindings. Incremental builds are not very useful, because they're not perfect and can miss changes. Use incremental builds e.g. when you're fixing linker errors.

The remaining flags are for Python bindings only:

  • MODE=none — disable optimization for faster build times. The default is MODE=release. To enable debug symbols, use MODE=debug. To set completely custom compiler flags, set EXTRA_CFLAGS and EXTRA_LDFLAGS.

  • NUM_FRAGMENTS=?? -j?? — adjust RAM usage vs build speed tradeoff. NUM_FRAGMENTS=?? is how many translation units the bindings are split into. -j?? is the number of parallel build threads/processes. NUM_FRAGMENTS=64 -j8 is the default, good for 16 GB of RAM.

    Guessing the fastest combination isn't trivial. Usually less fragments and more threads lead to faster builds but more RAM usage, but not always; turns out NUM_FRAGMENTS=1 isn't optimal even if you have enough RAM for it.

  • PYTHON_PKGCONF_NAME=python-3.??-embed — select Python version. We try to guess this one. You can set this to python3-embed to use whatever the OS considers to be the default version.

Installation

WASM

Install with npm or yarn:

npm install @alpinebuster/meshsdk
yarn add @alpinebuster/meshsdk

Python

For Python, simply install via pip:

pip install meshsdk

License

Here, you can access our Non-Commercial Free License with a Commercial License Requirement. Also, see license.

Packages

No packages published

Contributors 39