# Maximum perpendicular distance from line to convex hull boundary

13 ビュー (過去 30 日間)
Kwek Lawrence 2019 年 9 月 9 日
コメント済み: Kwek Lawrence 2019 年 9 月 12 日
I'm looking to find the max perpendicular distance of the 2 faces of a 2D convex hull perpendicular to a symmetry line (y=x). There are 3 possible scenarios
(1) convhull intersects with symline and max perpendicular distance occurs within the symline intersection
(2) convhull intersects with symline but max perpendicular distance to symline does not occur within the symline intersection
(3) convhull does not intersect with symline.
Would like to know how to do so in each of those cases.

#### 1 件のコメント

Kwek Lawrence 2019 年 9 月 12 日
I think I should rephrase my question.
The ultimate goal is to find the maximum width of a 2D convex hull in the direction perpendicular to the symmetry line. A figure of what I want to achieve and sample data are as attached.
I have convex hull generated based on x and y waveform coordinates.
k=convhull(x,y)
t=linspace(0,140,14001)
My thoughts: (1) Generate perpendicular lines from points on t, (2) determinine a set of 2 intersections with the convex hull for each line (3) Find largest distance between sets of intersections.
Would appreciate any help with this, or any other suggestions to achieve my initial objective.

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

### 採用された回答

Neuropragmatist 2019 年 9 月 10 日
I had to do something similar to this some time ago, sorry I don't really remember the specifics but I used rayTriGPU:
To find the intersection between a ray and all of the faces of a convex hull. There is some explanation in the code as to how to do this.
You could adapt this very easily I think to do what you want.
Hope this helps,
NP.

#### 3 件のコメント

Kwek Lawrence 2019 年 9 月 12 日
Thank you for your suggestion. I'm not too sure how applicable this would be, as I'm looking at intersections with the perimeter of a 2D convhull. My question has been further clarified in the comments and I will definitely appreciate further advice.
Neuropragmatist 2019 年 9 月 12 日
Oh sorry, I work on 3D data a lot so maybe I jumped the gun there.
Maybe you should look at the geom2D toolbox then:
If you think of your convex hull as a polygon then you want to find the intersections between it and your line and find the distance between them.
If I had more time at the moment I would code the specifics more closely, but I don't (and I hate geometry). The functions you need should all be in that toolbox though.
NP.
Kwek Lawrence 2019 年 9 月 12 日
Yea that helped. Thanks for your input!

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

### Community Treasure Hunt

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

Start Hunting!

Translated by