Giter VIP home page Giter VIP logo

line-arc-offset-demo's Introduction

LineArcOffsetDemo

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

It currently has two backends supporting arc segments: CGAL (used by OpenSCAD), and Open CASCADE (used by FreeCAD).

And three backends that approximate arcs with line segments: Clipper, Boost, and GEOS.

Screenshots

offset shapes combined shapes overlapping shapes

Dependencies

Mandatory dependencies:

  • Qt 5 (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 Ubuntu 18.04 (bionic) are:

  • qt5-default
  • libcgal-dev
  • libocct-modeling-algorithms-dev and libocct-modeling-data-dev and libocct-data-exchange-dev
  • liboce-modeling-dev
  • libpolyclipping-dev
  • libboost-dev
  • libgeos++-dev

NOTE: libocct is only available on newer Debian/Ubuntu distributions, so you'll either have to use liboce instead, or compile/install OCCT manually (see the instructions further down).

Open CACADE Technology (OCCT) vs. Open CASCADE Community Edition (OCE)

Open CASCADE Technology was forked at version 6.9.0 into a "Community Edition" that has a different version number scheme. The motivation was to more actively integrate user submitted patches. FreeCAD uses OCE and not official OCCT, and Debian/Ubuntu provide packages for OCE but not OCCT, making it more convenient to install.

https://en.wikipedia.org/wiki/Open_Cascade_Technology#Community_fork

Building Open CASCADE Technology

Official Open CASCADE Technology (not the Community Edition) packages are not available in Ubuntu's package repositories. You must instead compile it from the source.

For Debian 9 (stretch) and likely Ubuntu 18.04 (bionic), the following dependencies need to be installed to build Open CACADE 7.4.0:

sudo apt-get install cmake tk-dev libxmu-dev libxi-dev

The official website (linked earlier) wants you to log in with an account before allowing you to download any files. There is however a GitHub mirror with the sourcecode packages: https://github.com/tpaviot/oce/releases

Here are example commands for downloading, unpacking, compiling, and installing Open CASCADE 7.4.0:

cd ~/Downloads
wget -c https://github.com/tpaviot/oce/releases/download/official-upstream-packages/opencascade-7.4.0.tgz
tar xf opencascade-7.4.0.tgz
cd opencascade-7.4.0
mkdir build
cd build
cmake ..
make
make install

Configuring

You will want to edit the linearcoffsetdemo.pro file and choose which goemetry backends to use by commenting or uncommenting the appropriate lines. It is fine to have multiple engines enabled at the same time, the active engine can be chosen by passing the --engine command line option with the appropriate engine name.

This example shows using only OCE:

# GEOMETRY_ENGINES += cgal
# GEOMETRY_ENGINES += occt
GEOMETRY_ENGINES += oce
# GEOMETRY_ENGINES += clipper
# GEOMETRY_ENGINES += boost
# GEOMETRY_ENGINES += geos

This example shows using both CGAL and GEOS:

GEOMETRY_ENGINES += cgal
# GEOMETRY_ENGINES += occt
# GEOMETRY_ENGINES += oce
# GEOMETRY_ENGINES += clipper
# GEOMETRY_ENGINES += boost
GEOMETRY_ENGINES += geos

NOTE: both OCCT and OCE can be enabled at the same time, but only OCCT will actually be used (it overrides the other).

You may also need to modify the appropriate LIBS and QXX_CFLAGS lines for CGAL and OCCT/OCE depending on your platform.

Compiling

On Linux, run the following commands in the top-level directory with the linearcoffsetdemo.pro file:

qmake
make

Running

On Linux, you can launch the built LineArcOffsetDemo executable that will be put in the same directory as the linearcoffsetdemo.pro file:

./LineArcOffsetDemo

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

./LineArcOffsetDemo --engine geos

line-arc-offset-demo's People

Contributors

fdarling avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.