Coder Social home page Coder Social logo

cpp-spline's Issues

Splines with less than 4 control points

Hello, thanks for the effort put into this library, I want to use it for a project of mine but I need to be able to create splines (Bezier and Catmull) using 3 control points (and 2, but that's just a straight line), not the coded minimum of 4.

I have been looking into on how to do it but I can't really wrap my head around the math for it and also to create an implementation, any help regarding this? Thanks.

A Header-Only Library?

Hi,

A compilation issue came to me when I would like to run the test code. It seems to me that this package is header-only and there is no need to compile sth. However, compilation error is reported during the link stage

CMakeFiles/MyApp.dir/src/main.cc.o: In function `demo_bezier()':
/home/motion/cpp-spline/spline/src/test/cpp/src/main.cc:17: undefined reference to `Bezier::Bezier()'
/home/motion/cpp-spline/spline/src/test/cpp/src/main.cc:19: undefined reference to `Vector::Vector(double, double, double)'
/home/motion/cpp-spline/spline/src/test/cpp/src/main.cc:19: undefined reference to `Curve::add_way_point(Vector const&)'
/home/motion/cpp-spline/spline/src/test/cpp/src/main.cc:20: undefined reference to `Vector::Vector(double, double, double)'
/home/motion/cpp-spline/spline/src/test/cpp/src/main.cc:20: undefined reference to `Curve::add_way_point(Vector const&)'
/home/motion/cpp-spline/spline/src/test/cpp/src/main.cc:21: undefined reference to `Vector::Vector(double, double, double)'
/home/motion/cpp-spline/spline/src/test/cpp/src/main.cc:21: undefined reference to `Curve::add_way_point(Vector const&)'
/home/motion/cpp-spline/spline/src/test/cpp/src/main.cc:22: undefined reference to `Vector::Vector(double, double, double)'
/home/motion/cpp-spline/spline/src/test/cpp/src/main.cc:22: undefined reference to `Curve::add_way_point(Vector const&)'
/home/motion/cpp-spline/spline/src/test/cpp/src/main.cc:26: undefined reference to `Vector::toString[abi:cxx11]() const'
CMakeFiles/MyApp.dir/src/main.cc.o: In function `demo_bspline()':
/home/motion/cpp-spline/spline/src/test/cpp/src/main.cc:32: undefined reference to `BSpline::BSpline()'
/home/motion/cpp-spline/spline/src/test/cpp/src/main.cc:34: undefined reference to `Vector::Vector(double, double, double)'
/home/motion/cpp-spline/spline/src/test/cpp/src/main.cc:34: undefined reference to `Curve::add_way_point(Vector const&)'
/home/motion/cpp-spline/spline/src/test/cpp/src/main.cc:35: undefined reference to `Vector::Vector(double, double, double)'
/home/motion/cpp-spline/spline/src/test/cpp/src/main.cc:35: undefined reference to `Curve::add_way_point(Vector const&)'
/home/motion/cpp-spline/spline/src/test/cpp/src/main.cc:36: undefined reference to `Vector::Vector(double, double, double)'
/home/motion/cpp-spline/spline/src/test/cpp/src/main.cc:36: undefined reference to `Curve::add_way_point(Vector const&)'
/home/motion/cpp-spline/spline/src/test/cpp/src/main.cc:37: undefined reference to `Vector::Vector(double, double, double)'
/home/motion/cpp-spline/spline/src/test/cpp/src/main.cc:37: undefined reference to `Curve::add_way_point(Vector const&)'
/home/motion/cpp-spline/spline/src/test/cpp/src/main.cc:41: undefined reference to `Vector::toString[abi:cxx11]() const'
CMakeFiles/MyApp.dir/src/main.cc.o: In function `demo_catmullrom()':
/home/motion/cpp-spline/spline/src/test/cpp/src/main.cc:47: undefined reference to `CatmullRom::CatmullRom()'
/home/motion/cpp-spline/spline/src/test/cpp/src/main.cc:49: undefined reference to `Vector::Vector(double, double, double)'
/home/motion/cpp-spline/spline/src/test/cpp/src/main.cc:49: undefined reference to `Curve::add_way_point(Vector const&)'
/home/motion/cpp-spline/spline/src/test/cpp/src/main.cc:50: undefined reference to `Vector::Vector(double, double, double)'
/home/motion/cpp-spline/spline/src/test/cpp/src/main.cc:50: undefined reference to `Curve::add_way_point(Vector const&)'
/home/motion/cpp-spline/spline/src/test/cpp/src/main.cc:51: undefined reference to `Vector::Vector(double, double, double)'
/home/motion/cpp-spline/spline/src/test/cpp/src/main.cc:51: undefined reference to `Curve::add_way_point(Vector const&)'
/home/motion/cpp-spline/spline/src/test/cpp/src/main.cc:52: undefined reference to `Vector::Vector(double, double, double)'
/home/motion/cpp-spline/spline/src/test/cpp/src/main.cc:52: undefined reference to `Curve::add_way_point(Vector const&)'
/home/motion/cpp-spline/spline/src/test/cpp/src/main.cc:56: undefined reference to `Vector::toString[abi:cxx11]() const'
CMakeFiles/MyApp.dir/src/main.cc.o: In function `Curve::node(int) const':
/home/motion/cpp-spline/spline/src/main/cpp/../../main/cpp/Curve.h:28: undefined reference to `Vector::Vector(Vector const&)'
collect2: error: ld returned 1 exit status
CMakeFiles/MyApp.dir/build.make:109: recipe for target 'MyApp' failed
make[2]: *** [MyApp] Error 1
CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/MyApp.dir/all' failed
make[1]: *** [CMakeFiles/MyApp.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Can you provide me with an insight about what could be the cause for this problem?

Interpolation function coefficients

Hi,
Thanks for sharing the work. I want to fit curved line through given points. I am unable to understand how you chose the coefficient for interpolation function e.g. for CatmullRom you use the following function

interpolate(double u, const Vector& P0, const Vector& P1, const Vector& P2, const Vector& P3)
{
	Vector point;
	point=u*u*u*((-1) * P0 + 3 * P1 - 3 * P2 + P3) / 2;
	point+=u*u*(2*P0 - 5 * P1+ 4 * P2 - P3) / 2;
	point+=u*((-1) * P0 + P2) / 2;
	point+=P1;

	return point;
}

Can I use more than four control points ? I tried with more than four point but algorithm considering only 4 control points. Please help me, I am waiting for you reply.
Thanks in advance !!

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.