How to compute inside points in n dim convex hull?

14 ビュー (過去 30 日間)
stuti chug
stuti chug 2020 年 6 月 22 日
コメント済み: John D'Errico 2020 年 6 月 23 日
I'm working on convex hull and facing problem in computation of inside points. In 2D convex hull we can use inpolygon function for calculating inside points. But inpolygon function didn't work in n dim convexhull (convhulln function). Please help me out.

採用された回答

John D'Errico
John D'Errico 2020 年 6 月 22 日
I wrote inhull for this purpose. Find it here on the file exchange.
You can use it on a set of points directly, where it computes the convex hull for you.
xyz = rand(1000,5);
inhull([.5 .5 .5 .5 .5; 2 .5 .5 .5 .5],xyz)
ans =
2×1 logical array
1
0
Or you can precompute the convex hull.
tess = convhulln(xyz);
inhull([.5 .5 .5 .5 .5; 2 .5 .5 .5 .5],xyz,tess)
ans =
2×1 logical array
1
0
It even allows you to provide a tolerance.
  2 件のコメント
stuti chug
stuti chug 2020 年 6 月 22 日
Thankyou sir.
I also have one more query.
Actulally in inpolygon function it consider border point as inside points. so i want know that inhull function only compute inside points or it consider border points as inside points.
John D'Errico
John D'Errico 2020 年 6 月 23 日
inhull does not distinguish between a point that lies exactly on the boundary or inside. It works in floating point arithmetic as it must. As such, it tests for an inequality of the general form <=0. But you should never worry about a floating point value being exacly zero, and that is what would need to happen for a point to be seen as exactly on a boundary. There will alsys be some floating point trash in the result, so values that are within +/- delta, for some small value of delta would arguably be viewed as being on the boundary itself.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeBounding Regions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by