All Projects → vicrucann → CurveFitting

vicrucann / CurveFitting

Licence: MIT license
〰️ Curve fitting based on Schneider's algorithm. Written using C++11 and OpenSceneGraph (visualization)

Programming Languages

C++
36643 projects - #6 most used programming language
CMake
9771 projects

Projects that are alternatives of or similar to CurveFitting

NAGPythonExamples
Examples and demos showing how to call functions from the NAG Library for Python
Stars: ✭ 46 (-38.67%)
Mutual labels:  curve-fitting
IVBezierPathRenderer
Alternative Path Renderer for Apple MapKit to render path with bezier curve
Stars: ✭ 31 (-58.67%)
Mutual labels:  bezier-curves
smoothers
Visualizations of various one-dimensional smoothers using the d3 javascript library.
Stars: ✭ 18 (-76%)
Mutual labels:  curve-fitting
lodToolkit
level-of-details toolkit(LTK). Convert osgb lod tree to 3mx tree. Convert pointcloud in ply/las/laz/xyz to 3mx/osgb tree.
Stars: ✭ 81 (+8%)
Mutual labels:  openscenegraph
bezmouse
Simulate human mouse movements with xdotool
Stars: ✭ 110 (+46.67%)
Mutual labels:  bezier-curves
PersonDemo
🔥 一些个人学习中备份的技术方案
Stars: ✭ 16 (-78.67%)
Mutual labels:  bezier-curves
fundamental
Software to look for interrelationships between constants and find formulas for number sequences
Stars: ✭ 14 (-81.33%)
Mutual labels:  curve-fitting
curve cad
Blender Addon: Bezier Curve CAD Tools for CNC Milling & Laser Cutting
Stars: ✭ 107 (+42.67%)
Mutual labels:  bezier-curves
QtOSG
A proof-of-concept widget for integrating Qt and OpenSceneGraph in a thread-safe manner
Stars: ✭ 103 (+37.33%)
Mutual labels:  openscenegraph
Hybrid-A-Star-U-Turn-Solution
Autonomous driving trajectory planning solution for U-Turn scenario
Stars: ✭ 75 (+0%)
Mutual labels:  curve-fitting
COMPASS
The OpenATS COMPASS (Compliance Assessment) tool aims at providing a generalized framework for air-traffic surveillance data analysis, visualization & evaluation.
Stars: ✭ 60 (-20%)
Mutual labels:  openscenegraph
bezier-editor
A tool base on HTML5 canvas to create bezier curve like photoshop and then it can be exported as JavaScript code to create an animation path for an HTML element.
Stars: ✭ 21 (-72%)
Mutual labels:  bezier-curves
levenberg-marquardt
Curve fitting method in JavaScript
Stars: ✭ 63 (-16%)
Mutual labels:  curve-fitting
phaser3-plugin-pathbuilder
Draw and edit Lines, Bezier Curves, Splines at runtime, explore your scene and export your paths to Phaser
Stars: ✭ 67 (-10.67%)
Mutual labels:  bezier-curves
osg2vsg
Deprecated adapter library for converting OpenSceneGraph Images and 3D models to VulkanSceneGraph
Stars: ✭ 31 (-58.67%)
Mutual labels:  openscenegraph
OpenFrames
Realtime interactive scientific visualization API
Stars: ✭ 28 (-62.67%)
Mutual labels:  openscenegraph
pyeq3
A large collection of equations for Python 3 curve fitting and surface fitting that can output source code in several computing languages, and run a genetic algorithm for initial parameter estimation. Comes with cluster, parallel, IPython, GUI, NodeJS, and web-based graphical examples. Includes orthogonal distance and relative error regressions.
Stars: ✭ 31 (-58.67%)
Mutual labels:  curve-fitting
BezierCanvas
Adobe Illustrator's pen tool style bezier editor on Unity.
Stars: ✭ 126 (+68%)
Mutual labels:  bezier-curves
PeakFit
A peak-fitting tool based on MATLAB for spectroscopic data analysis.
Stars: ✭ 25 (-66.67%)
Mutual labels:  curve-fitting
BezierCurves2D
An implementation of 2D Bezier Curves in C++ using OpenGL, gl3w, glfw3 and imgui.
Stars: ✭ 41 (-45.33%)
Mutual labels:  bezier-curves

Curve fitter

A C++11-based class that performs curve fitting based on An algorithm for automatically fitting digitized curves by Philip J. Schneider which was published in Graphics gems, 1990. The algorithm is presented with minor modifications and improvements.

Requirements

Currently the project requires installed OpenSceneGraph (>= 3.4.0) and C++11 compatible compiler.

Curve fitter class

Use the OsgPathFitter class or derive your own using the base PathFitter class.

Sub-classing the PathFitter

The PathFitter is a template abstract class. Which means, you have to sub-class it and provide your own implementation for the pure virtual functions and for certain operators (e.g., dot product, cross product, etc.). The list of functions and their expected behaviour is described in the following sub-sections.

Constructor

The constructor does not require any implementation, but it requires to provide a list of arguments for the used templates. In the case of OsgPathFitter, the template arguments are:

  • osg::Vec3Array is a vector of a 3D component. In the base class it has a template name Container.
  • osg::Vec3f is a 3D (used as 2D) component of type float, i.e., given the above Container = Vec3Array(Vec3f, Vec3f, ...). In the base class the template has a name Point2D.
  • float is a real type of which the Point2D consists of, i.e., Vec3f(float, float, float). In the base class it has a name Real.

Method fit()

It is the main loop method that launches the fitting algorithm. It is designed to be re-implemented with the option to use smart pointer of choice. In case of OsgPathFitter, we chose osg::ref_ptr<>.

The main steps that are needed to be in the method are:

  1. Allocate new Container memory (manage it by means of smart pointer of choice if you wish).
  2. Calculate tangents of the extreme points as shown in the OsgPathFitter::fit() example using curveAt() and normalize() functions.
  3. Launch method PathFitter::fitCubic() provided a newly allocated container where the results will be saved, the tolerance error, the container's first and last point indexes, and the calculated tangent.
  4. Return the pointer on the allocated container which will contain the result points.

Method getDistance()

Must return an Euclidean distance between two Point2Ds. Of course, depending on the number of dimensions of your Points, the formula will vary. Refer to the provided OsgPathFitter example for more details.

Method getNANPoint()

Must return a Point2D with initialized values of NAN (from math.h).

Implementation of operator's

The base class PathFitter uses some notations taken from OpenSceneGraph API:

  • Real r = V1 * V2 is the operator for dot product between vectors V1 and V2.
  • Vec2 V = V1 ^ V2 is the operator for cross product between vectors V1 and V2.
  • Vec2 V = V0 * s is the operator for scaling of vector V0 by real s.
  • normalize() performs normalization of vector so that it length becomes unity.
  • length2() is the squared length of the vector.

Template definitions

In your custom class, it is necessary to provide template definitions. As it was mentioned above, you provide the definitions in the custom constructor. The full definitions must be provided at the end of your .cpp implementation file of the custom path fitter class.

The PathFitter class must also contain the full definition to avoid the LNK2019, Unresolved external symbol. For this purpose, we prepared a file called PathFitter-impl.cpp that is to contain such definitions. Note we use the separate file simple for convenience reasons so that do not add custom definitions into the PathFitter abstract class.

Usage of LibPathFitter in an external project

The PathFitter and its derivatives and compiled into a library libPathFitter so that to be easily used from an external project. In this case, you will only need to modify your project's corresponding CMakeLists.txt file. For example:

add_subdirectory(CurveFitting/libPathFitter)
link_directories(${CMAKE_BINARY_DIR}/src/libNumerics/CurveFitting/libPathFitter)
# ...
target_link_libraries( libExternal
    libPathFitter
    ${QT_LIBRARIES}
    ${OPENSCENEGRAPH_LIBRARIES}
# ... any other libs
)

For a live example, feel free to refer to Cherish project and its corresponding CMakeLists.txt.

Licence

See the corresponding licence file.

Examples

On the image, 60 sampled curve (red color) is represented by a 1 cubic Bezier curve (green color).

Screenshot

Another example that includes 3 curves representing 180 sampled path.

Screenshot

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].