0
$\begingroup$

On a randomly generated convex hull, I found the two points of maximum distance on the region's perimeter (the points in black). I would like to find two points that lie on the perpendicular to this black line, of maximum distance. (Illustrated in red in this picture) enter image description here

I first generated a random convexhull.

points = RandomReal[{1, 3}, {np, 2}];
ch = ConvexHullMesh@points;

Here I found the 2 points of maximum distance on the polygon's perimeter.

maxPoints = 
  Quiet@NArgMax[
    Norm[{x, y} - {u, v}], {{x, y} \[Element] ch, {u, v} \[Element] ch}];

My first thought would be to "scan" perpendicular intersections along the line formed by 2 black points, but I'm not sure how to go about doing that.

Thank you!

$\endgroup$
  • $\begingroup$ Your question isn't entirely clear to my reading. Do you mean you are looking for the longest red line, perpendicular to the black line, which remains within the polygon ? If so, you only need to test the perpendiculars which pass through one of the vertices of the polygon. $\endgroup$ – High Performance Mark Apr 26 at 13:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.