Remeshing points on curved line
Show older comments
Hello,
I have the arclength coordinates S1, S2, S3 ... SN of N = 551 points along a curved line.
I would like to now "squeeze" in 6,001 points (without increasing the total length) and determine the new arclength coordinates S1, S2, S3 ... SM (M = 6,001).
I don't want to consider the obvious solution of dividing up the total length evenly unless I have to. Rather, I ideally want to keep as many of the original points fixed as possible.
Thank you!
3 Comments
the cyclist
on 20 Mar 2013
You need to supply several more details.
I am not sure I understand what an "arclength coordinate" is. What does each Sn look like? Is it a single value, or a vector of values? How are they stored?
For "S1.5" that is between S1 and S2, how do you want to determine the value of S1.5? Linear interpolation? Exact formula?
Are your Sn's equally spaced? If not, do you want more points where there are bigger gaps, or not?
Rene
on 20 Mar 2013
Wouter
on 20 Mar 2013
In that case you could just use interp1 I guess.
Accepted Answer
More Answers (1)
If it is a straight line with evenly spaced points you could do this:
S % original S; % Nx2 matrix
from_value = S(1); % first point, assuming S is sorted
to_value = S(end); % last point
new_S = [linspace(from_value,to_value,length(S)+6001)]; % new S is 6001 points larger
However if the S is a curve, it is a bit more difficult; you would need to fit a polygon or a spline which decribes your current curve and then resample it using 6001 more points.
Categories
Find more on Interpolation of 2-D Selections in 3-D Grids in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!