LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

B-spline curve: wrong interpolation

Solved!
Go to solution
Solution
Accepted by topic author Erfan_Persia

@Kyle97330 wrote:

I'm pretty sure that the problem is that the spline fit needs to get the points to fit in order, but when you say you "sorted the points" what you are actually saying is that you sorted them by one of their coordinate values... NOT the order the points should appear in.

 

If your data looks somewhat circular all the time, you could try something like this instead:

1. Start by doing a circle fit.  LabVIEW doesn't have one, but it has a sphere fit which works as a circle fit if you just use zero for all of the Z values.

2. Take the center of that circle.  From there, calculate the angle to each point.

3. Sort the points by that angle.

4. Pass the points using that sorting to the spline algorithm.

 

If your data doesn't always look circular you might have to get more creative with the sorting, but you need to put them in actual order, not just sort by one column of values and disregard the order of the other column.


 

instead of fitting your data to a circle, you could use a 2d average  to estimate the circle's center point:

Spoiler
sort2d-angle-avg.png

 

 

raw   demo
alexderjuengere_0-1661086622001.png

 

alexderjuengere_1-1661086641019.png

 

demo.gif

 

 

0 Kudos
Message 11 of 12
(625 Views)

if I hadn't switched those two terminals

 

alexderjuengere_0-1661088470002.png

 

 

the result looks like this:

 

Spoiler

 

center - data

alexderjuengere_1-1661088533411.png

before: data - center

alexderjuengere_2-1661088565349.png

 

 

 

0 Kudos
Message 12 of 12
(608 Views)