# For an enclosed surface region, how to find the furthest point on that surface to another point that is not on that surface?

I have an enclosed 3D surface (a distorted sphere surface region, which is got by finding an enclosed contour of a 3D volumetric data, and apply RegionBoundary[BoundaryDiscretizeGraphics[ ]] to get the region of this surface), and I use the function "RegionCentroid" to find the geometric center of that region. I want to find the coordinates of points that is on the surface and is nearest/furthest from the center. I know I can use the function "RegionNearest" to find the nearest one, but how can I manage to find the furthest one? I think maybe I could select a huge amount of random points on the surface and find the one that is furthest but this will inevitable brings error. So I wonder if there is some more accurate approach? I appreciate it if someone could help me out!

• For the type of region described, the centric will be inside rather than outside the region. Aug 8 '20 at 16:28
• Your title suggests the points you want are on the outside of the region, but the body of your question says "I want to find the coordinates of points that is on the surface". I assumed in my answer that you're asking for the points on the surface. Perhaps you could clarify? Aug 8 '20 at 17:36
• Sorry for my being a bit unclear...My region here refer to the 2D surface in the 3D space without the space that it surrounds inside so the center point should be surrounded by the surface but not on the surface (thus not being in the region). Aug 8 '20 at 19:43
• Thanks for clarifying and improving subject header. Aug 9 '20 at 14:45

The problem can be framed as a maximization:

(* generate some blob region and its boundary *)
pts = Join[RandomPoint[Sphere[], 100], RandomPoint[Sphere[{.4, .5, .6}, .8], 100]];
blob = RegionBoundary[ConvexHullMesh[pts]];

centroid = RegionCentroid[blob];
rdf = RegionDistance[blob];

{distmax,resultmax}=NMaximize[Norm[{x, y, z} - centroid], {x, y, z} ∈ blob];
{distmin,resultmin}=NMinimize[Norm[{x, y, z} - centroid], {x, y, z} ∈ blob];

Graphics3D[{Thick, Red, AbsolutePointSize[10], Point[centroid],
Line[{centroid, {x, y, z} /. resultmax}], Blue,
Line[{centroid, {x, y, z} /. resultmin}], White, Opacity[.2], blob},
Boxed -> False]


• Ummm... the question asks for the "a given point OUTSIDE that region." Aug 8 '20 at 16:42
• @DavidG.Stork the title does, but the body of the question says "I want to find the coordinates of points that is on the surface and is nearest/furthest from the center" Aug 8 '20 at 17:33
• Then I urge you to fix your incorrect title as soon as possible. Aug 8 '20 at 18:22
• Sorry for the unclarity. the "region" here should be the surface itself but not the space it encloses. Please see my changed title, which I think should be more clear. Aug 8 '20 at 19:50
• I just tried this out with the region I got from the ListContourPlot3D and it worked perfectly. Thanks for the answer and it really teaches me a good way to deal with this type of problem! Thanks so much! Aug 8 '20 at 20:03