MATLAB Answers

## How to find the arclength and radius of curvature for a set of 3D data points?

Asked by Matthew Wong

### Matthew Wong (view profile)

on 5 Nov 2018
Latest activity Commented on by Matthew Wong

### Matthew Wong (view profile)

on 16 Nov 2018
Accepted Answer by Are Mjaavatten

### Are Mjaavatten (view profile)

I have a set of 3-D points that represent the coordinates of a curve. I need to find the arclength and radius of curvature of this curve. How might I go about doing this? I've tried fitting the data to a polynomial but it doesn't seem to be working. Please Help!

Matt J

### Matt J (view profile)

on 6 Nov 2018
@Matthew Wong,
If the problem is with the fitting, as John surmises, and not with the actual arclength and curvature calculation, then please go back to your original thread on that topic and pick up the discussion there, adding data and other information as proposed by John.
Matthew Wong

### Matthew Wong (view profile)

on 12 Nov 2018
Thanks for the feedback guys! I've attached my data this time. Basically right now I try to break up the data into smaller sections that encompass only one section of the curve so that it better fits a polynomial. Then I use the 'fit' equation to go through and try to fit a polynomial to each section. Then I try to find the arclength of each section (Right now I'm only trying to calculate the arclength, after I get a correct fit for the data I'll move on to radius of curvature).
if true
%Initialize empty arrays and variables to prevent memory overload
syms s x y;
Pts = zeros(100,3);
magnitudes = zeros(99,1);
dx = zeros(99,1);
dy = zeros(99,1);
dz = zeros(99,1);
dscore = zeros(99,1);
magdiff = zeros(99,1);
Sigpts = zeros(100,3);
lowbound = 1;
fitdata=zeros(100,3);
arclength=zeros(100,1);
%Load points into a 100 x 3 array
for j=1:100
Pts(j,1) = xpts(j);
Pts(j,2) = ypts(j);
Pts(j,3) = zpts(j);
end
%Plot the curvature
%plot3(Pts(:,1),Pts(:,2),Pts(:,3));
% grid on;
hold off;
end
Matthew Wong

### Matthew Wong (view profile)

on 12 Nov 2018
Update: I had some trouble posting my entire code, but I've attached the MATLAB file above.

Sign in to comment.

R2016b

## 1 Answer

Answer by Are Mjaavatten

### Are Mjaavatten (view profile)

on 16 Nov 2018
Edited by Are Mjaavatten

### Are Mjaavatten (view profile)

on 16 Nov 2018
Accepted Answer

I was inspired by your question to write a functon that calculates the arc length and curvature of a 1D curve in 2D or 3D space. I believe that does what you want. I submitted it to The Mathworks File Exchange today. You will find it here.

Matthew Wong

### Matthew Wong (view profile)

on 16 Nov 2018
Exactly what I was looking for, thanks!

Sign in to comment.