← Back

ofxLib2Geom

github.com/Daandelange/ofxLib2Geom · @Daandelange
OF 0.11 Bridges Geometry 2D

OF wrapper for lib2geom (from Inkscape), providing a set of geometrical functions on vector data.

0 0 Last commit 1mo ago Created 2y ago

README

ofxLib2Geom



An OpenFrameworks wrapper for lib2geom, the vector engine used in Inkscape. It provides a set of algoritms for computing 2D vector data.

Warning! Requires C++17 (lower lib2geom versions provide down to C++11 compatibility, but there have been API changes)

Note about lib2geom : While many features are implemented, lib2geom is moving away from their previous geometry lib Livarot, some features of Inkscape remain in that library until they are moved. Also, Inkscape still has some code parts left in its own code base, only partly using lib2geom. Path offsetting and boolean operations are sadly in that case.

Early State

I was looking for boolean operations and path offsetting, which are not well integrated into this lib yet. I'm leaving this addon as is, as it provides a lot of other useful algebra.

Only tested on Linux + C++17 + OF0.11.2, using makefiles or qt-creator, should not be hard to compile on Mac + Win as long as you're using C++17.

Setup

Check the lib2geom dependencies, you can find them in their readme.

Install dependencies on linux

apt install libdouble-conversion-dev apt-get install libgtest-dev

Alternative: Install with package manager apt install lib2geom-dev (installs old v1.1, on 01-2024) Note : currently needed on Linux to link, but could be build within the OF project too.

Compile library

cd /path/to/lib2geom mkdir build && cd build cmake .. -D2GEOM_TESTING=OFF make or make dist

Configure your project

If you're using OF 0.11.2 or below; configure your project to use C++17 or 20. In your project's config.make: PROJECT_CFLAGS = -std=c++17

Coding with lib2geom



Docs

Their doxygen docs are a bit old and need to be compile manually, but there's a nice manual that explains some base principles and a wiki FAQ with some tips.

Logics

There's no glue yet so you'll have to find out how to use lib2geom. Good luck ! The example shows how to setup a Path, apply an offset and display the result.

Here are some tips :

License

ofxLib2Geom is MIT. lib2geom is LGPL 2.1 + MPL 1.1.

Credits

Made by Daan de Lange. Powered by lib2Geom from the Inkscape team. .

Get this addon

HTTPS
SSH