ShapeOp
 All Classes Files Functions Variables Typedefs Macros Pages
libShapeOp

C++ libShapeOp

libShapeOp is a lightweight C++ library for static and dynamic geometry processing. The main library is located in libShapeOp/src. The library can also be used as header only if SHAPEOP_HEADER_ONLY is defined. OpenMP can be activated by passing -DOPENMP=TRUE as options to CMake. The library can be compiled in double or in float by changing the ::ShapeOpScalar typedef located in Common.h. An example on how to use libShapeOp is provided (libShapeOp/bindings/c++/runme.cpp).

C API

A C API is provided along with the C++ library. The API is located in libShapeOp/api. This C API is useful when libShapeOp needs to be used from another programming language (see Automatic Bindings with SWIG for example). An example on how to use the API is provided (libShapeOp/bindings/c/runme.c).

Automatic Bindings with SWIG

SWIG (http://www.swig.org/) is a tool to automatically create binding between programs written in C and C++ and a variety of programming languages such as Javascript, Perl, and Python. The code generated by SWIG is compatible with both commercial and non-commercial projects. To install SWIG Unix or Mac use your favorite package manager. For Windows download the binary from the SWIG website. The CMake file builds Python, Java, and C# bindings as an example.

Python.

To generate the Python bindings you will need to pass -DSWIG_PYTHON=TRUE as options to CMake. A runme.py file is also provided (libShapeOp/bindings/python/runme.py). It shows how the Python bindings can be used to call libShapeOp. The runme.py file can be executed from the build directory by typing

Java.

To generate the Java bindings you will need to pass -DSWIG_JAVA=TRUE as options to CMake. A runme.java file is also provided (libShapeOp/bindings/java/runme.java). It shows how the Java bindings can be used to call libShapeOp. The runme.java file can be executed from the build directory by typing

C#.

To generate the C# bindings you will need to pass -DSWIG_CSHARP=TRUE as options to CMake. A runme.cs file is also provided (libShapeOp/bindings/csharp/runme.cs). It shows how the C# bindings can be used to call libShapeOp. Under Unix first install Mono (http://www.mono-project.com) using the package manager. The runme.cs file can then can be executed from the build directory by typing

Coding Rules

We are using astyle (http://astyle.sourceforge.net/) to enforce a coding style for the library. To install astyle under Unix or Mac use your favorite package manager. For Windows download the binary from the astyle website. The style file libShapeOp.astyle can be found in the libShapeOp/astyle folder along with a bash script run_astyle.sh to run astyle with libShapeOp coding style.