Skip to content

Commit

Permalink
Merge branch 'pre_release'
Browse files Browse the repository at this point in the history
  • Loading branch information
stribor14 committed Mar 31, 2020
2 parents 3666a9d + d2ef445 commit 210700e
Show file tree
Hide file tree
Showing 18 changed files with 6,579 additions and 768 deletions.
521 changes: 0 additions & 521 deletions BezierCpp/bezier.cpp

This file was deleted.

54 changes: 54 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
cmake_minimum_required(VERSION 3.1)
project(Bezier
LANGUAGES CXX
VERSION 0.2.0)

add_compile_options(-std=c++11 -march=native -fPIC)

find_package(Eigen3 REQUIRED)
include_directories(SYSTEM ${EIGEN3_INCLUDE_DIR})

set(Bezier_SRC
src/bezier.cpp
src/polycurve.cpp
)

set(Bezier_INC
include/Bezier/declarations.h
include/Bezier/legendre_gauss.h
include/Bezier/bezier.h
include/Bezier/polycurve.h
)

# Options

if(NOT LEGENDRE_GAUSS_PRECISION)
message(STATUS "Setting Legendre Gauss precision to default value (10).")
set(LEGENDRE_GAUSS_PRECISION 10)
endif()

option(BUILD_SHARED_LIBS "Build shared library (.so) instead of static one (/.a)" OFF)

# build rules

if(BUILD_SHARED_LIBS)
add_library(bezier SHARED ${Bezier_SRC})
else()
add_library(bezier STATIC ${Bezier_SRC})
endif()

target_include_directories(bezier PUBLIC
$<BUILD_INTERFACE:${Bezier_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

target_compile_definitions(bezier PRIVATE LEGENDRE_GAUSS_N=${LEGENDRE_GAUSS_PRECISION})

set_target_properties(bezier PROPERTIES VERSION ${PROJECT_VERSION})
set_target_properties(bezier PROPERTIES PUBLIC_HEADER "${Bezier_INC}")

# install rules
install(TARGETS bezier
EXPORT bezier-export DESTINATION "lib"
PUBLIC_HEADER DESTINATION "include/Bezier")
install(EXPORT bezier-export DESTINATION "lib/cmake/Bezier" FILE BezierConfig.cmake)
52 changes: 50 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Bezier-Cpp
[![Build Status](https://travis-ci.com/stribor14/Bezier-cpp.svg?branch=master)](https://travis-ci.com/stribor14/Bezier-cpp)
<<<<<<< HEAD
![v0.1](https://img.shields.io/badge/version-0.1-blue.svg)
=======
![v0.2](https://img.shields.io/badge/version-0.2-blue.svg)
>>>>>>> pre_release
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/aceb46ce7de1407abd56cfc127dba5f1)](https://www.codacy.com/app/stribor14/Bezier-cpp?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=stribor14/Bezier-cpp&amp;utm_campaign=Badge_Grade)

Fast and lightweight class for using the Bezier curves of any order in C++
Expand All @@ -10,6 +14,7 @@ Fast and lightweight class for using the Bezier curves of any order in C++
## Key Features
- Any number of control points
- Fast operations on curves
<<<<<<< HEAD
- Dynamic manipulation

## Implemented methods
Expand All @@ -34,15 +39,55 @@ Fast and lightweight class for using the Bezier curves of any order in C++
- [x] Document polycurve features
- [ ] More sophisticated example
- <img src="https://img.shields.io/badge/v.0.3-planned-red.svg" alt="v0.3 planned" align="top"> Bezier shapes
=======
- Dynamic manipulation
- Composite Bezier curves (polycurves)

CMake *find_package()* compatible!
```
find_package(Bezier)
target_link_libraries(target bezier)
```

## Implemented methods
- Get value, derivative, curvature, tangent and normal for parameter *t*
- Get t from projection any point onto a curve
- Get precise length for any part of curve
- Get a derivative curve (hodograph)
- Split into two subcurves
- Find curve roots and bounding box
- Find points of intersection with another curve
- Elevate/lower order
- Apply parametric and geometric continuities
- etc.

## Wish list
- [ ] Polycurve - oversee continuities between consecutive sub-curves
- [ ] Polycurve - propagation of sub-curve manipulation depending on continutiy
- [ ] Bezier shapes
- [ ] More sophisticated example
>>>>>>> pre_release
## Dependencies
- c++11
- Eigen3

*Add compile flag* `-march=native` *when compiling to use vectorization with Eigen.*
## Instalation
### System-wide installation
```
git clone https://github.com/stribor14/Bezier-cpp
mkdir Bezier-cpp/build
cd Bezier-cpp/build
cmake ..
make
make install
```
### ROS
- for use within a ROS workspace without the system-wide installation, clone the repo to src folder in you catkin workspace

## Example program
## Example program __[OUTDATED]__
A small Qt5 based program written as a playground for manipulating Bezier curves.
<<<<<<< HEAD
### Usage
- Starts with two Bezier curves (with 4 and 5 control points respectively)
- Zoom in/out: *__Ctrl + mouse wheel__*
Expand All @@ -52,6 +97,9 @@ A small Qt5 based program written as a playground for manipulating Bezier curves
- Raise order of the curve: *__Double left click__*
- Lower order of the curve *__Double right click__*
- Toggle bounding boxes and curve intersections: *__Double middle click__*
=======
- press *__H__* for a list of possible actions
>>>>>>> pre_release
### Additional dependencies
- qt5-default
Expand Down
24 changes: 16 additions & 8 deletions example/bezier_example.pro
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,32 @@ DEFINES += QT_DEPRECATED_WARNINGS
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0

CONFIG += c++11
CONFIG += c++17
QMAKE_CXXFLAGS += -march=native

INCLUDEPATH += /usr/include/eigen3 \
../BezierCpp
../include

SOURCES += \
main.cpp \
mainwindow.cpp \
../BezierCpp/bezier.cpp \
qgraphicsviewzoom.cpp \
customscene.cpp
qgraphicsviewzoom.cpp \
customscene.cpp \
qcurve.cpp \
qpolycurve.cpp \
../src/bezier.cpp \
../src/polycurve.cpp \

HEADERS += \
mainwindow.h \
../BezierCpp/bezier.h \
qgraphicsviewzoom.h \
customscene.h
qgraphicsviewzoom.h \
customscene.h \
qcurve.h \
qpolycurve.h \
../include/Bezier/bezier.h \
../include/Bezier/polycurve.h \
../include/Bezier/declarations.h \
../include/Bezier/legendre_gauss.h \

FORMS += \
mainwindow.ui
Expand Down
Loading

0 comments on commit 210700e

Please sign in to comment.