Code Monkey home page Code Monkey logo

bezier_curve's Introduction

Build Status License: MIT

Generic Bezier Curve Library

  • Generic Bezier Curve Library that supports control points of arbitary dimension numbers. (2D and 3D for normal, curvature calculations).
  • Class of control point Container is built on top of Eigen Matrix; but can possibly be replaced with user-defined Point Container Class (which is quite a tedious task if starting from 0).

Dependencies

  • Eigen : Current build with cmake was tested on Ubuntu 18.04. Build on lower version of Ubuntu OS might require modification of CMake to find Eigen OR manually build latest Eigen from source.
  • Doxygen : Only used for building documentations. The lack of doxygen does not affect the building of this library.

How to Build

cd /path/to/bezier_curve
mkdir build && cd build
cmake ../ && cmake --build .

Build Options

  • WITH_DEBUG=ON/OFF(default: OFF) : whether to enable debug
  • WITH_GTEST=ON/OFF(default: OFF) : whether to enable gtest
  • BUILD_EXAMPLES=ON/OFF(default: OFF) : whether to enable build examples
  • BUILD_DOC=ON/OFF(default: ON) : whether to build doc (by doxygen) or not
  • WITH_VISUALIZATION=ON/OFF(default: OFF) : whether to build examples with visualization (currently used matplotlib_cpp for visualization)

General Usage

See Examples

Examples

2d points

Example for 5-degree bezier curve of the following 2d control points:

Source Code

3d points

Example for 9-degree bezier curve of the following 3d control points:

Source Code

point projection from an external point to bezier curve

In this function, I implemented the algorithm presented in the following paper:

Xiao-Diao Chen, Yin Zhou, Zhenyu Shu, Hua Su, Jean-Claude Paul. Improved Algebraic Algorithm
On Point Projection For Bézier Curves. Proceedings of the Second International Multi-Symposiums
on Computer and Computational Sciences (IMSCCS 2007), The University of Iowa, Iowa City, Iowa,
USA, Aug 2007, Iowa, United States. pp.158-163, ff10.1109/IMSCCS.2007.17ff. ffinria-00518379f

Source Code

bounding box for bezier curve

Source Code

Acknowledgement

  • This library is inspired by the following Bezier library, which supports only 2D space (as of 21st June, 2019).
  • I partly reused the code introduced in https://computingandrecording.wordpress.com/2017/03/20/closest-point-to-a-cubic-spline/ for the functionality of point projection.

bezier_curve's People

Contributors

xmba15 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.