A CGAL-free, MIT-licensed reimplementation of the Alpha Wrapping algorithm that takes a defective triangle soup and produces a watertight, manifold, outward-oriented mesh with controllable level of detail and tightness.

Stars

4

7-day growth

No data

Forks

0

Open issues

0

License

MIT

Last updated

2026-07-29

AI repository intelligence
FR-AI / ANALYSIS

Why it is worth attention

It provides a fully independent, copyleft-free alternative to CGAL's Alpha Wrap, matching its geometric guarantees and topology on nearly all tested inputs while being ~2× faster in a GMP-free environment, and comes with clean Python bindings and a comprehensive test suite.

Who it is for

  • Researchers and practitioners in geometry processing
  • Engineers working on 3D model repair and mesh generation
  • 3D printing enthusiasts needing watertight enclosures
  • Developers requiring a permissive-licensed robust surface wrapping library

Use cases

  • Repairing non-manifold, self-intersecting, or open triangle soups for downstream processing
  • Generating a watertight, manifold surface that strictly encloses a noisy or defective input model
  • Adjusting wrapping coarseness (alpha) to preserve or fill features like holes and handles
  • Comparing results against CGAL's official implementation for validation or tuning

Strengths

  • Fully self-contained with no copyleft dependencies (only Shewchuk's public-domain predicates)
  • Provides the same watertight, 2-manifold, outward-oriented guarantees as CGAL, verified on many inputs
  • Competitive performance (often ~2× faster than CGAL in a GMP-free setup) with similar face counts
  • Exhaustive tests covering exact predicates, Delaunay invariants, AABB oracle, and end-to-end wrap invariants

Considerations

  • Requires network access at build time to fetch predicate sources; C++17 and CMake ≥3.16 needed
  • The optional CGAL reference backend is GPL-encumbered and not part of the core MIT license
  • Geometric constructions (circumcenters, Steiner points) are inexact, though algorithm tolerates it by design

README quick start

alpha-wrap

A clean-room, CGAL-free and copyleft-free implementation of "Alpha Wrapping with an Offset" (Portaneri, Alliez, Hemmer, Birklein, Kobbelt — ACM TOG 2022).

Given an arbitrary input triangle soup (which may be non-manifold, self-intersecting, open, or defective) and two parameters — alpha (the carving-ball radius / level of detail) and offset (the distance-field iso-level / tightness) — it produces a surface mesh that is:

  • watertight (closed),
  • combinatorially 2-manifold,
  • outward-oriented,
  • strictly enclosing the input, with vertices ~offset outside it,
  • bounded within an O(alpha+offset) band of the offset surface, every facet having circumradius ` soup = /* your input */; aw::WrapStats stats; aw::Mesh m = aw::alpha_wrap(soup, /alpha=/0.05, /offset=/0.002, /manifold=/true, &stats); // m.V : vertices, m.F : outward-oriented triangles

## Python bindings

Install from source (builds the C++ extension via scikit-build-core + nanobind;
needs a C++17 compiler, CMake ≥ 3.16, and network access on first build to fetch
the predicates):

```bash
pip install .
# or straight from GitHub:
pip install "git+https://github.com/alecjacobson/alpha-wrap.git"

Usage — wrap takes a triangle soup (vertices, faces) and returns the wrapped (V, F) as NumPy arrays (float64 and int32):

import numpy as np
import alpha_wrap

V = np.asarray(vertices, float)     # (N, 3)
F = np.asarray(faces, np.int64)     # (M, 3), may be non-manifold / defective

# relative parameters (fractions of the bounding-box diagonal)
W, G = alpha_wrap.wrap(V, F, alpha_rel=1/30, offset_rel=1/900)

# or absolute, and grab the internal stats
W, G, stats = alpha_wrap.wrap(V, F, alpha=0.05, offset=0.002,
                              manifold=True, return_stats=True)

Defaults follow the paper: alpha = diag/20, offset = alpha/30. The output is watertight, outward-oriented, 2-manifold, and strictly encloses the input.

Optional CGAL reference backend

The package can additionally expose alpha_wrap.wrap_cgal(...), which runs CGAL::alpha_wrap_3 for comparison/validation. It is off by default (it fetches Boost + CGAL at build time).

Related repositories

Similar projects matched by category, topics, and programming language.

ammaarreshi
ammaarreshi GitHub avatar

Generals-Mac-iOS-iPad

This repository ports Command & Conquer Generals: Zero Hour to run natively on Apple Silicon Macs, iPhones, and iPads without emulation, adding touch controls and modern rendering.

C++
1,523
MSNightmare
MSNightmare GitHub avatar

LegacyHive

This repository contains a proof-of-concept for a Windows User Profile Service elevation-of-privilege vulnerability that loads an arbitrary hive into the current user's classes root.

C++
275
kigner
kigner GitHub avatar

audio.cpp-webui

audio.cpp is a high-performance C++ audio inference framework built on ggml that provides a unified local runtime for TTS, ASR, voice cloning, and other audio tasks, with a WebUI, CLI, server, and performance optimizations for CUDA.

C++
245