2geom Math Library First Public Release

The 2geom library is a math library for “Paths, curves, and other geometric calculations. Designed for vector graphics, it tackles Bézier curves, conic sections, paths, intersections, transformations, and basic geometries”.  It was developed for use in the open source Inkscape graphics application in collaboration with Monash University.  Designed originally to improve Inkscape 1.0, the 2geom library was just officially released for public consumption outside of Inkscape development.  This cross platform C++ library is released under a dual LGPL 2.1 and MPL 1.1 open source license.

Features of 2geom:

  • C++
  • Functional programming style.
  • Points
  • Efficient affine transformations
  • Rectangles
  • Convex Hulls
  • Bounded error
  • General purpose paths:
    • Exact elliptical arcs
    • Area
    • Centroid and bending moments
  • Path Locations:
    • Determination of special spots (e.g. maximum curvature)
    • Splitting
    • Point, tangent, curvature at location
    • Efficient arc length and inverse arc length
  • Path algebra:
    • Computations such as offset curves can be written with their mathematical definition and still get a bounded error, efficient curve. (preliminary trials indicate offset done this way out performs the method used in Inkscape)
  • Arbitrary distortion (with bounded error):
    • Mesh distorts
    • Computational distorts such as the GIMP’s ‘vortex’ plugin
    • 3d mapping (perspective, flag, sphere)
  • Exact boolean ops (elliptic arcs remain elliptic arcs)
  • Efficient 2d database
  • Implicit function plotting
  • NURBs input and output
  • Tunable path simplification
  • PDoF constraint system for CAD/CAGD

If you are interested in learning more about this release, be sure to check the following post on the Inkscape website, while more details and the library itself are available on GitLab.

GameDev News

Scroll to Top