PERIMETER OF A 3D POLYGON WHICH DOES NOT LIE IN THE X-Y PLANE
2 views (last 30 days)
Show older comments
Hi everyone,
I have the spatial coordinates (x,y,z) of a cloud of points.
To date, I am able to calculate the area of the polygon in space obtained interpolating these points. Any suggestions abou how to calculate the perimeter?
Thank you in advance
6 Comments
Bjorn Gustavsson
on 5 Jul 2022
@Torsten: In 3-D it isn't obvious that a cloud of points are flat. There would still be a "natural" area from the convex hull, but I wasn't sure there would be a unique perimeter. But now I see that the points seem to lie in a plane - or near enough.
Accepted Answer
Torsten
on 5 Jul 2022
The code should apply to your case:
x = 3*cos(0:pi/20:2*pi);
y = 3*sin(0:pi/20:2*pi);
fn = cscvn([x;y]);
% Compute enclosed area
fnprime = fnder(fn);
Kofs = @(s) [1 -1]*(fnval(fn,s) .* flipud(fnval(fnprime,s)));
A = 1/2*integral(Kofs,fn.breaks(1),fn.breaks(end))
pi*3^2
% Compute curve length
Lfun = @(s) sqrt(sum(fnval(fnprime,s).^2,1));
L = integral(Lfun,fn.breaks(1),fn.breaks(end))
2*pi*3
2 Comments
More Answers (0)
See Also
Categories
Find more on Point Cloud Processing 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!