/compas_cgal

COMPAS package for working with CGAL.

Primary LanguageC++GNU Lesser General Public License v3.0LGPL-3.0

COMPAS CGAL

build GitHub - License Conda - Latest Release Conda - Platform

This package provides Python bindings for specific algorithms of CGAL. The bindings are generated with PyBind11 and data is exchanged using NumPy arrays.

More information is available in the docs: https://compas.dev/compas_cgal/

Installation

compas_cgal is available via conda-forge for Windows, OSX, and Linux, and can be installed using conda.

conda create -n cgal -c conda-forge compas compas_cgal --yes

Dev Install

Create a development environment with the required dependencies using conda and compile and install an editable version of compas_cgal using setuptools.

Windows:

conda create -n cgal-dev python=3.10 mpir mpfr boost-cpp eigen=3.3 cgal-cpp pybind11 scip=9.0.0 --yes
conda activate cgal-dev
git clone https://github.com/compas-dev/compas_cgal
cd compas_cgal
pip install -e .'[dev]'

Mac:

conda create -n cgal-dev python=3.10 gmp mpfr boost-cpp eigen=3.3 cgal-cpp pybind11 scip'>=9.0' --yes
conda activate cgal-dev
git clone https://github.com/compas-dev/compas_cgal
cd compas_cgal
pip install -e .'[dev]'

Note that the version of eigen is important and should be 3.3.

To add a new c++ module to the Python wrapper, or to exclude some of the existing modules during development you can modify the list of extension modules in setup.py.

ext_modules = [
    Extension(
        'compas_cgal._cgal',
        sorted([
            'src/compas_cgal.cpp',
            'src/compas.cpp',
            'src/meshing.cpp',
            'src/booleans.cpp',
            'src/slicer.cpp',
            'src/intersections.cpp',
            'src/measure.cpp',
        ]),
        include_dirs=[
            './include',
            get_eigen_include(),
            get_pybind_include()
        ],
        library_dirs=[
            get_library_dirs(),
        ],
        libraries=['mpfr', 'gmp'],
        language='c++'
    ),
]

Usage

The provided functionality can be used directly from the compas_cgal package or from compas.geometry through the plugin mechanism in COMPAS.

For examples, see https://compas.dev/compas_cgal/latest/examples.html.

License

compas_cgal is released under the LGPL 3.0 to be compatible with the license of CGAL.