By definition, the interior point is a point inside an arbitrary region like this:
In picture above, $y$ is an interior point of region. My question is how to find the distance of an interior point from it's boundary?
I have this Idea: By using the polygons, we can approximate the perimeter of region by a n-gon (n is large enough). Then by saving the coordinates of perimeter in two vectors, say $x$ and $y$, and use Nearest
command we can find nearest point of perimeter from interior point ($y$).
I created data matrices (find from here) in MATLAB and import to Mathematica.
imp = Import["PI.mat", "LabeledData"];
X = "KP" /. imp;
Y = "KI" /. imp;
But I can't know how to use Nearest
command when we have large vectors like X
and Y
:
Nearest[{Flatten@X, Flatten@Y}, {3, 1.5}]
An error appears, because Flatten@X
, Flatten@Y
and {3, 1.5}
are not the same length.
X
Y
but maybe you want:Nearest[Transpose@{X, Y}, {1.5, 3}]
? $\endgroup$Y
are two simple vectors. I used that, but not sure it's correct. But what does it (Transpose
) do? $\endgroup$RegionDistance
andSignedRegionDistance
? $\endgroup$