Volume of 3D polyhedron

조회 수: 24 (최근 30일)
slaiyer
slaiyer 2014년 8월 24일
댓글: Iila 2016년 2월 25일
Given a set of 3D coordinates, how can one find the volume of the polyhedron that is not necessarily convex?
  댓글 수: 7
Matt J
Matt J 2016년 2월 24일
Iila
Iila 2016년 2월 25일
Thank you. But it doesn't. My polyhedra are concave. I also want to calculate the self intersecting volume, if any.

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

채택된 답변

Mike Garrity
Mike Garrity 2016년 2월 24일
One option you might look at is alphaShape. It's similar to convhull, but more general. It will create non-convex shapes.
You use it like this. First I need a simple cloud of points.
npts = 75;
pts = randn(npts,3);
scatter3(pts(:,1),pts(:,2),pts(:,3),'filled')
Then I create my alphaShape, and plot it.
shp = alphaShape(pts);
h = plot(shp);
But the reason this might be useful for you, is that it has a method that will return the volume of the shape:
volume(shp)
ans =
27.3914
And another method which will tell you whether other points are inside the shape.
testpts = randn(150,3);
inmask = inShape(shp,testpts);
h.FaceColor = [.75 .75 .75];
h.FaceAlpha = .25;
hold on
scatter3(testpts(inmask,1),testpts(inmask,2),testpts(inmask,3),'.','MarkerEdgeColor','green')
scatter3(testpts(~inmask,1),testpts(~inmask,2),testpts(~inmask,3),'.','MarkerEdgeColor','red')
  댓글 수: 1
slaiyer
slaiyer 2016년 2월 24일
This seems to be exactly what I was looking for back then. Thanks a lot for your input; cheers!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Bounding Regions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by