필터 지우기
필터 지우기

PERIMETER OF A 3D POLYGON WHICH DOES NOT LIE IN THE X-Y PLANE

조회 수: 2 (최근 30일)
Francesca Danielli
Francesca Danielli 2022년 7월 5일
편집: Torsten 2022년 7월 5일
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
Francesca Danielli
Francesca Danielli 2022년 7월 5일
yes
I used this function
h=fnplt(cscvn(p(:,[1:end 1])),'g',2)
where p is a 3x10 array (number of row 3 for spatial coordinates x,y,z and coloumn 10 for the available points)
It returns h, a 3xN array (with N number of additionally points for a better interpolation)
Bjorn Gustavsson
Bjorn Gustavsson 2022년 7월 5일
@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.

댓글을 달려면 로그인하십시오.

채택된 답변

Torsten
Torsten 2022년 7월 5일
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))
A = 28.2726
pi*3^2
ans = 28.2743
% Compute curve length
Lfun = @(s) sqrt(sum(fnval(fnprime,s).^2,1));
L = integral(Lfun,fn.breaks(1),fn.breaks(end))
L = 18.8491
2*pi*3
ans = 18.8496
  댓글 수: 2
Francesca Danielli
Francesca Danielli 2022년 7월 5일
I tried and it works for the perimeter! I compared the obtained results with an expected one from raw analytical calculations!
I am currently having problems with the calcualtion of the area you suggested, but I am trying to face it! In anycase, I have another method for the area calculation!
Thanks so much for your help
Torsten
Torsten 2022년 7월 5일
편집: Torsten 2022년 7월 5일
I just noticed that the area calculation only works for closed curves in the x-y plane.
For closed curves in 3d lying in a plane, things will become more complicated.
But you said that you have already determined the enclosed area :-)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Computational Geometry에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by