Giter Site home page Giter Site logo

vicrucann / curvefitting Goto Github PK

View Code? Open in Web Editor NEW
92.0 8.0 19.0 137 KB

:wavy_dash: Curve fitting based on Schneider's algorithm. Written using C++11 and OpenSceneGraph (visualization)

License: MIT License

CMake 5.30% C++ 94.70%
curve-fitting algorithm schneider c-plus-plus openscenegraph bezier-curves library

curvefitting's People

Contributors

vicrucann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

curvefitting's Issues

Test of exponential sensitivity

This is James Phillips, author of the Python language pyeq3 curve fitting library on GitHub at https://github.com/zunzun/pyeq3. I include in my code's unit tests a test of exponential sensitivity that you might be interested in, the equation to be fitted is

y = a * exp(bx) + Offset

and the data for the test is

x y
0.9 -2997.81165143259
1.5 -2997.67633151454
13.8 -2992.05019674501
19.8 -2985.51451402968
24.1 -2977.73207770987
28.2 -2966.44629865572
35.2 -2932.4311430723
60.3 -2168.56994123603
74.6 474.296114697706
81.3 3789.59913028271

Fitted coefficients should be

a = 2.0
b = 0.1
Offset = -3000.0

The test is quite sensitive. My nonlinear fitter uses the Differential Evolution genetic algorithm to determine initial parameters for the Levenberg-Marquardt nonlinear fitter in scipy's Python fitter.

James

`handle1` and `handle2` in `generateBezier()` should be instantiated with `getNANPoint()`

I realize this repo has been untouched for many years and I don't know if PRs are welcome but I think this is a small bug with an easy fix. In the function generateBezier(), two Point2 variables are instantiated with their default constructor. The following block of code may or may not modify them. Then they are tested for "NaN-ness" with isNaN(). If the Point2's default constructor does not initialize the point's coordinates with NAN, I believe this test will sometimes fail when it should succeed.

It's my understanding that the code expects Point2 to default initialize to NaN when that may not always be the case. It is indeed not the case for osg::Vec3f which default initializes to all 0.

Easy fix. This line:
Point2 handle1, handle2;

should be:

Point2 handle1 = this->getNANPoint(), handle2 = this->getNANPoint();

I've observed the effect of this bug with a sawtooth path and the first two segments of the resulting curve had control points P1 and P2 equal to P0 and P3 respectively.

Bad:
Screenshot 2023-05-30 at 15 36 53

Fixed:
Screenshot 2023-05-30 at 15 36 16

That second screenshot is also what one can observe with paper.js

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.