Raúl Otaño
Raúl Otaño

Reputation: 4760

How to interpolate N points in WPF

The idea is simple, supose i have a collection of 2D points that have N items. I want a path that interpolate that points in a soft way.

I tried using Cubic Bezier but the problem is that it take only 3 point, if i want using N point where N % 3 = 1 or N % 3 = 2 then dosent works, beside even using N % 3 = 0 in the intersection of both Beizers is not soft (make a peak). Using Quadratic Bezier do not work because it is a curve, for example if N = 2, then draws a cuadratic curve betwen both points.

I would like to know a way for do this, if is easy and efficient better.

Upvotes: 0

Views: 1274

Answers (2)

Raúl Otaño
Raúl Otaño

Reputation: 4760

Just for doing this, I implemented a library that can be found in github:

And all of this is based in this article.

Upvotes: 0

Rawling
Rawling

Reputation: 50114

Bezier curves can be used to interpolate between any number of points, not just two or three.

Have a look at constructing Bezier Curves and the geometric interpretation of De Casteljau's algorithm. In particular I've implemented that second link myself in the past, but I'm struggling to put it into better words than the article iteself does.

Upvotes: 4

Related Questions