Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interpolation function coefficients #1

Open
tanajikamble13 opened this issue Sep 18, 2019 · 2 comments
Open

Interpolation function coefficients #1

tanajikamble13 opened this issue Sep 18, 2019 · 2 comments

Comments

@tanajikamble13
Copy link

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

@keshwh-work
Copy link

keshwh-work commented Sep 18, 2019 via email

@CycloneRing
Copy link

hi @keshwh-work, the function is yours i can confirm, here it is :

Vector CatmullRom::interpolate(double u, const Vector& P0, const Vector& P1, const Vector& P2, const Vector& P3)

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

realtime-test.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants