cpp-spline icon indicating copy to clipboard operation
cpp-spline copied to clipboard

Interpolation function coefficients

Open tanajikamble13 opened this issue 6 years ago • 2 comments

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 !!

tanajikamble13 avatar Sep 18 '19 13:09 tanajikamble13

I don’t think the function listed below is mine. Sorry.

Kevin

On Wed, Sep 18, 2019 at 6:57 AM tanajikamble13 [email protected] wrote:

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=uuu*((-1) * P0 + 3 * P1 - 3 * P2 + P3) / 2; point+=uu(2P0 - 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 !!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/chen0040/cpp-spline/issues/1?email_source=notifications&email_token=AFMB5PYYGUCYXYB2PAVXOHDQKIXUVA5CNFSM4IX7GC42YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HME2QMQ, or mute the thread https://github.com/notifications/unsubscribe-auth/AFMB5P3UIHQKXZ2XQWEOLC3QKIXUVANCNFSM4IX7GC4Q .

keshwh-work avatar Sep 18 '19 14:09 keshwh-work

hi @keshwh-work, the function is yours i can confirm, here it is : https://github.com/chen0040/cpp-spline/blob/198aa5c31190f64b0813700e014a501ee9aa940f/spline/src/main/cpp/CatmullRom.cpp#L31

He's right after we add more points it goes bad, This is a very good library you made, best on github if you can fix this it will be great, I'm using it right now in a real time app and it works great

https://user-images.githubusercontent.com/91777373/176567966-fafdc17d-aebc-4770-9d75-bbb5b7df23a2.mp4

CycloneRing avatar Jun 30 '22 00:06 CycloneRing