Skip to main content

Spade C++ triangulation library packaged for Python projects (C++ only, no Python bindings)

Project description

dtcc-pyspade-native

PyPI version License Python

Ship the Spade C++ triangulation library with your Python package - no Python bindings, just pure C++ for your C++ extensions.

What is this?

dtcc-pyspade-native packages the Spade C++ Delaunay triangulation library for distribution via PyPI. It's designed for Python projects that have C++ components and need fast, robust 2D triangulation.

Key Point: This package provides C++ libraries only - no Python API. Use it when your Python project already has C++ extensions (pybind11, Cython, etc.) and you want to use Spade in that C++ code.

Quick Start

Install

pip install dtcc-pyspade-native

Use in Your Python Project

pyproject.toml:

[build-system]
requires = ["scikit-build-core", "pybind11", "dtcc-pyspade-native>=0.1.0"]

[project]
dependencies = ["dtcc-pyspade-native>=0.1.0"]

CMakeLists.txt:

find_package(Python REQUIRED COMPONENTS Interpreter)

execute_process(
    COMMAND ${Python_EXECUTABLE} -c "import pyspade_native; print(pyspade_native.get_cmake_dir())"
    OUTPUT_VARIABLE PYSPADE_CMAKE_DIR
    OUTPUT_STRIP_TRAILING_WHITESPACE
)

find_package(pyspade_native REQUIRED PATHS ${PYSPADE_CMAKE_DIR} NO_DEFAULT_PATH)

target_link_libraries(your_module PRIVATE pyspade_native::spade_wrapper)

your_module.cpp:

#include <spade_wrapper.h>

void triangulate() {
    std::vector<spade::Point> polygon = {{0,0,0}, {1,0,0}, {0.5,1,0}};
    auto result = spade::triangulate(polygon, {}, {}, 0.5,
                                     spade::Quality::Moderate, true);
    // Use result.points, result.triangles...
}

Features

  • Easy Distribution: Install via pip, no manual C++ library management
  • Cross-Platform: Pre-built wheels for Linux, macOS, Windows
  • CMake Integration: Clean find_package() support
  • No Rust Required: Ships pre-built Rust FFI library
  • C++17: Modern C++ API with STL containers
  • Constrained Delaunay: Full CDT support with mesh refinement

Use Cases

Perfect for:

  • Python packages with pybind11/Cython/cffi extensions
  • GIS applications with C++ backends
  • Scientific computing tools
  • CAD/CAM software with Python interfaces
  • Any Python project that needs C++ triangulation

Documentation

Python Helper API

import pyspade_native

# Get paths for your build system
include_dir = pyspade_native.get_include_dir()
library_dir = pyspade_native.get_library_dir()
cmake_dir = pyspade_native.get_cmake_dir()

# Get available libraries
libs = pyspade_native.get_libraries()
# {'spade_wrapper': '/path/to/libspade_wrapper.so',
#  'spade_ffi': '/path/to/libspade_ffi.so'}

# Print installation info
pyspade_native.print_info()

C++ API

The Spade C++ wrapper provides a clean, modern interface:

namespace spade {
    // Triangulate a polygon with optional holes and interior constraints
    TriangulationResult triangulate(
        const std::vector<Point>& outer,
        const std::vector<std::vector<Point>>& holes = {},
        const std::vector<std::vector<Point>>& interior_loops = {},
        double maxh = 1.0,
        Quality quality = Quality::Default,
        bool enforce_constraints = true
    );

    enum class Quality {
        Default,   // No angle constraints
        Moderate   // 25-degree minimum angle
    };

    struct TriangulationResult {
        std::vector<Point> points;
        std::vector<Triangle> triangles;
        std::vector<Edge> edges;
        size_t num_vertices() const;
        size_t num_triangles() const;
        size_t num_edges() const;
    };
}

Example Project

See examples/complete-project for a full working example of a Python package that uses dtcc-pyspade-native.

cd examples/complete-project
pip install .
python -c "from my_package import triangulate; print(triangulate([[0,0],[1,0],[0.5,1]]))"

Building from Source

git clone https://github.com/dtcc-platform/dtcc-pyspade-native
cd dtcc-pyspade-native
pip install -e .

Development

# Install in editable mode
pip install -e ".[dev]"

# Run tests
pytest tests/

# Build wheels
python -m build

# Run examples
cd examples/complete-project && pip install . && python test.py

Requirements

For Installation

  • Python 3.8+
  • C++ compiler with C++17 support
  • CMake 3.15+

For Building from Source

  • All of the above
  • Rust toolchain (automatically fetched if not present)

Contributing

Contributions welcome! See CONTRIBUTING.md for guidelines.

License

Dual-licensed under MIT OR Apache-2.0, matching the Spade library.

Acknowledgments

This project packages the Spade library by Stefan Löffler for easy Python distribution. Developed as part of the DTCC Platform.

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dtcc_pyspade_native-0.1.1b0.tar.gz (46.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

dtcc_pyspade_native-0.1.1b0-cp312-cp312-win_amd64.whl (200.0 kB view details)

Uploaded CPython 3.12Windows x86-64

dtcc_pyspade_native-0.1.1b0-cp312-cp312-win32.whl (190.5 kB view details)

Uploaded CPython 3.12Windows x86

dtcc_pyspade_native-0.1.1b0-cp312-cp312-manylinux_2_28_x86_64.whl (273.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

dtcc_pyspade_native-0.1.1b0-cp312-cp312-macosx_11_0_arm64.whl (248.2 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

dtcc_pyspade_native-0.1.1b0-cp311-cp311-win_amd64.whl (200.0 kB view details)

Uploaded CPython 3.11Windows x86-64

dtcc_pyspade_native-0.1.1b0-cp311-cp311-win32.whl (190.5 kB view details)

Uploaded CPython 3.11Windows x86

dtcc_pyspade_native-0.1.1b0-cp311-cp311-manylinux_2_28_x86_64.whl (273.0 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

dtcc_pyspade_native-0.1.1b0-cp311-cp311-macosx_11_0_arm64.whl (248.2 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

dtcc_pyspade_native-0.1.1b0-cp310-cp310-win_amd64.whl (200.0 kB view details)

Uploaded CPython 3.10Windows x86-64

dtcc_pyspade_native-0.1.1b0-cp310-cp310-win32.whl (190.5 kB view details)

Uploaded CPython 3.10Windows x86

dtcc_pyspade_native-0.1.1b0-cp310-cp310-manylinux_2_28_x86_64.whl (273.0 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

dtcc_pyspade_native-0.1.1b0-cp310-cp310-macosx_11_0_arm64.whl (248.2 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

dtcc_pyspade_native-0.1.1b0-cp39-cp39-win_amd64.whl (200.0 kB view details)

Uploaded CPython 3.9Windows x86-64

dtcc_pyspade_native-0.1.1b0-cp39-cp39-win32.whl (190.5 kB view details)

Uploaded CPython 3.9Windows x86

dtcc_pyspade_native-0.1.1b0-cp39-cp39-manylinux_2_28_x86_64.whl (273.0 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ x86-64

dtcc_pyspade_native-0.1.1b0-cp39-cp39-macosx_11_0_arm64.whl (248.2 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

dtcc_pyspade_native-0.1.1b0-cp38-cp38-win_amd64.whl (200.0 kB view details)

Uploaded CPython 3.8Windows x86-64

dtcc_pyspade_native-0.1.1b0-cp38-cp38-win32.whl (190.5 kB view details)

Uploaded CPython 3.8Windows x86

dtcc_pyspade_native-0.1.1b0-cp38-cp38-manylinux_2_28_x86_64.whl (273.0 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.28+ x86-64

dtcc_pyspade_native-0.1.1b0-cp38-cp38-macosx_11_0_arm64.whl (248.1 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

File details

Details for the file dtcc_pyspade_native-0.1.1b0.tar.gz.

File metadata

  • Download URL: dtcc_pyspade_native-0.1.1b0.tar.gz
  • Upload date:
  • Size: 46.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for dtcc_pyspade_native-0.1.1b0.tar.gz
Algorithm Hash digest
SHA256 578864060127a97fee6f7ea6f92958351bb6ef10b2bc03064c8498ae0eaf5c54
MD5 9b0062d3070f35b03eced40e3d72b1e2
BLAKE2b-256 e18ece789bfed1da1bed3fa3127390bebeb1e829e4e703a0d88efc01521116c8

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.1b0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.1b0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 3058dfc7befed215af42d0a8f40ec502a15097cefec258f06a08d016e7fb3e1d
MD5 3847f79cae8f42407279de912b13a895
BLAKE2b-256 c920e2d0be9602ebfe52239f54232211f897d7dfbf9815bda529e5d5d7b1b93c

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.1b0-cp312-cp312-win32.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.1b0-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 af41a7c16ffd5598edb8c79f72fa0578e8ee2a913ff11876289ba7c5cd93b298
MD5 bc4ac58ead3d4cf3abb4ef2e43c5c091
BLAKE2b-256 b8fc6b2eddc8a40f1f64c447f7fb4d2b0da4c3cf46b7053a112f55f5043a8192

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.1b0-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.1b0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ac800f6732f9fd75596858b001f507f82b4ea8d58c241c94837c9d39ee47111e
MD5 aec3614e57ceef3d1ffb5f2fca21f3aa
BLAKE2b-256 3478b0342f9c5fd56c536d488a0b65c82ea71da3d25718dd0f61c05c47030a43

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.1b0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.1b0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 810f738fbe45bd3b37d6c877cc1e000d88deaadea23eeb3af1a37ed95ed735f7
MD5 2facc61708ac81c56c967262243e8a1c
BLAKE2b-256 da9d0061f51efbed62cc1cc289d41f11e37ce581d523ea8c9f5512681e0c17b3

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.1b0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.1b0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a78a7fee492eadc4a7b1a9de1f073531d1a9755343b41da9821b3903da9591f0
MD5 282b3ea6c55a5832fd9c7fa0377c5e28
BLAKE2b-256 8741380082c8702fd685c2b8c3f4bc7c461dcaba4e8e9d9d04d6f2b1d0c0a4cd

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.1b0-cp311-cp311-win32.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.1b0-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 b0a445ee8dde7ba50daeb3f8c8ac99e815aafe3e8bd7cdc9ee8092be5e63c419
MD5 bcca322edd399b33f1f1eb1dc97fc332
BLAKE2b-256 a01309e80c26cf6d2c30ff53d2466dcef48f77b0ddf19207cddc243291360e49

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.1b0-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.1b0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6ac7015b85c7ffd04f8bad81f4d87745f40e1066556054517ee5d9f4ee4cea6c
MD5 c7628d0bc8c42fa74a751c1ead781758
BLAKE2b-256 8e09570739bf8ed68fca0a585593647c7f29b47fb3ff6e70a8e92928d5a64315

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.1b0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.1b0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 604c98f89d976f2953aa8b5c4637a38b3b09b30aa69daf635e8ce7924300a551
MD5 dbdf503063bf0af94df4da53bd4b6f6e
BLAKE2b-256 da7c2479dde42b198d70350542200d7f2221e54f4f4ea99cef36112e8c54d287

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.1b0-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.1b0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 681c786f6b886e9d6e200cf7af757363a11a33ee5d5ee6c16b725bb37c42fe1e
MD5 b96b41b5a6a508b691a00e8867f03785
BLAKE2b-256 a55849c778e3ff0447716419d86f3e2527b4c630153e32c0e7a4bd916df3d071

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.1b0-cp310-cp310-win32.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.1b0-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 5789a648aadba15e8a608cc643ba62a110bc4773f110defeab89ea57b738c272
MD5 2cc79ddce4a37bdc8c858a0a1632c588
BLAKE2b-256 a3f7e8725075cd1f926b6ab74c550ecfa47a46880ee5752a4faa56c52905c441

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.1b0-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.1b0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 db48a4e51a8ad23bccbc1c9d3ee38a2e914928863efb8254baf2158c332a69ed
MD5 8ca1938c8068751554f59a3fd0ae986f
BLAKE2b-256 6de4f6da37c2f4b392ed99e01342a94164cd20f446fc6b16d85af34dbce68b99

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.1b0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.1b0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5728aa08790459ebd14df675fce6a21fa9713e571bca241b2b2d9c45d9b8384b
MD5 a8fd794574c386aa4efdedd9ed9c532c
BLAKE2b-256 9db69f1a8b0fd6d51c7180d47e9073cc9b2ee2b10af0a7302c8e1f65b9bf7774

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.1b0-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.1b0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 97bdd23708c4628159fa85c4d36d8d7c683355728fe54c632e14e0735b5841b0
MD5 0c010c5f294daf03ba419c1e364268cd
BLAKE2b-256 3cb01c973930c863f9976af08ed0b0658e02d5156d787540555898746ea6b6e4

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.1b0-cp39-cp39-win32.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.1b0-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 218afed50d9bb7c59e29633407451029f02f64f5987c91cdfcdbaf31edbde348
MD5 19e82975e494ae47fad7712dfff1348e
BLAKE2b-256 eb62eba884641844699c99aebfeca1426c36d3d190a629c441813ddb06f66fd4

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.1b0-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.1b0-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 215183ba74293344eedd0c550d6a81839329d0026ff08bfc5aef3f093bafbae7
MD5 1bf16dd43396637fbe57659e8b54d012
BLAKE2b-256 c866b99923a09fbd80e615d10c6dbfd049c9a1c095c3cb005226a7e20aa030cb

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.1b0-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.1b0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5c8a72c9aea35073f8eeb79deac694a061ad153a2659d1fb647fa71578bc80ae
MD5 83d9dc11f3a5399aefa305561f7a5b55
BLAKE2b-256 ea07ebabfd974316e1a3ef3ae64e941a4c23b05c5d7a1d9cd7af67936855f0ac

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.1b0-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.1b0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 82aea78d1cefa75ebd7d78a00b55cfe11cb7d81796c3e94182d2efea64a27dbf
MD5 6d3118a32064adbcfbb627d0b4d51bf5
BLAKE2b-256 1cd165413fbdfcd2e797a136481a40415958c4dc8bd825b03f74e65f86e16bb8

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.1b0-cp38-cp38-win32.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.1b0-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 3ebc7621895960dde72373a2bbd380b7e0495105bee86276ade9946adc22fe5e
MD5 c6d4f77ade250600a4de42e7b83f9374
BLAKE2b-256 0c1cb4893ff6c18053db5a8be0e73b4465f1077c14a82af4a7978164ba68bd52

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.1b0-cp38-cp38-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.1b0-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e2e3c093da9c28271f721d9a0b507479b87a7a943f3d49f983e77aa24a621cab
MD5 b85e1f4c67d04f6103ef498bf9b47d4a
BLAKE2b-256 23018883bc9f7e47425343ed18f9963f9f1c4d67e6b7c5bc8dfeefb3cb82f022

See more details on using hashes here.

File details

Details for the file dtcc_pyspade_native-0.1.1b0-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dtcc_pyspade_native-0.1.1b0-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4cf74f245d9e3cb2560fd76a381e4279f9b26e6a7325ef243043effd43597be3
MD5 50312fbec4d92a94f826e33717d1f3dc
BLAKE2b-256 eed14a3bcf5272e5c4a68b74530f12babb5c796d085e03fddf22c3175ae391a4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page