Skip to content

C++ Library for least squares fitting of circles

Notifications You must be signed in to change notification settings

RobMa/circle_fit

Repository files navigation

circle_fit

circle_fit is a least-squares circle fitting library written in C++.

Examples

There is also a Python and MATLAB binding. The example below was generated with Python and Matplotlib. See src/python/example_animation.py.

Here is an example plotted from MATLAB. The corresponding code is in src/matlab/example.m.

.

Build instructions

Build requirements are a C++14 compiler, cmake and Python3 for code generation.

git clone git@github.com:RobMa/circle_fit.git
cd circle_fit
mkdir build && cd build && cmake .. && cd ..
cmake --build build

The library depends on Eigen3, spdlog and Catch2. cmake will download the dependencies automatically and store the in the extern folder.

MATLAB MEX build instructions

The circle_fit functions can be called directly from MATLAB, if the mex files are in the MATLAB path. To build the mex-files set the cmake flag BUILD_MEX:

cd build
cmake .. -DBUILD_MEX=ON
cd ..
cmake --build build

Then add the build folder to the MATLAB path.