Skip to content

fdarling/line-arc-offset-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

109 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LineArcOffsetDemo

A demo program written with C++/Qt to show offsetting of shapes comprised of line and arc segments. It also can perform boolean operations on these shapes.

It currently has three backends that natively support arc segments: CGAL (used by OpenSCAD), and Open CASCADE (used by FreeCAD), and CavalierContours (lesser known, mostly abandoned for a Rust rewrite).

There are five backends that approximate arcs with line segments: Clipper, Clipper2, Boost, and GEOS.

Screenshots

offset shapes combined shapes overlapping shapes

Dependencies

Mandatory dependencies:

  • CMake v3.31 (v3.13+ required)
  • Qt v5.15 (widgets and xml modules)

Optional dependencies for different engines:

NOTE: the version numbers are for reference, other versions may work too.

The relevant development packages to install on Debian 13 (trixie) are:

  • qtbase5-dev
  • libcgal-dev
  • libocct-modeling-algorithms-dev and libocct-modeling-data-dev and libocct-data-exchange-dev
  • libpolyclipping-dev
  • libboost-dev
  • libgeos++-dev

Compiling

Run the following commands in the top-level directory with the CMakeLists.txt file:

mkdir build
cd build
cmake .. -DUSE_GEOS=ON
cmake --build .

You can add one or more -DUSE_xxx=ON to enable various engines as backends:

  • -DUSE_CGAL=ON for CGAL
  • -DUSE_OCCT=ON for OpenCASCADE
  • -DUSE_CAVC=ON for CavalierContours
  • -DUSE_CLIPPER=ON for Clipper
  • -DUSE_CLIPPER2=ON for Clipper2
  • -DUSE_BOOST=ON for Boost
  • -DUSE_GEOS=ON for GEOS

Running

You can launch the built LineArcOffsetDemo executable that will be put in the build directory:

./LineArcOffsetDemo

An example of manually specifying the engine to use (useful if multiple engines are enabled):

./LineArcOffsetDemo --engine geos

Here are the various options:

  • --engine cgal for CGAL
  • --engine occt for OpenCASCADE
  • --engine cavc for CavalierContours
  • --engine clipper for Clipper
  • --engine clipper2 for Clipper2
  • --engine boost for Boost
  • --engine geos for GEOS

About

demo showing offsetting of shapes comprised of line/arc segments, as well as boolean operations

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors