Clear Filters
Clear Filters

Calculating distance from central point to perimeter of shape engulfing central point.

1 view (last 30 days)
Hi all, I'm trying to make a code which takes a non-moving graph point and calculates the distance from that point to the nearest perimeter point of a shape surrounding it. The shape may vary in sides and location relative to that central point, but the central point will always be located inside of the shape. English is not my first language, so pardon me if this is unprofessionally written. I will attempt to clarify further if it is needed. Thanks, all.

Accepted Answer

Matt J
Matt J on 10 Jul 2018
Edited: Matt J on 10 Jul 2018
How is the shape represented? As an image? If so, bwdist() will give you the result directly. You could also do
[i,j]=find(yourImage);
mindist=min( (i-i0).^2 + (j-j0).^2 );

More Answers (0)

Categories

Find more on Computational Geometry 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!