I am studying the maxima of function $ \overline{r}(x,y)$ of closed shapes.

Suppose the curve is star-shaped with respect to this center point $ \mathbf p=(u,v)$ , so that any ray emanating from $ \mathbf p$ meets the curve exactly once, at say point $ \mathbf q$ . Then $ r = \|\mathbf q – \mathbf p\|$ , $ \theta$ is the angle between $ \mathbf q-\mathbf p$ and the $ x$ -axis, $ \overline{r}(x,y)$ is the average radius $ $ \overline{r}(x,y)=\frac1{2\pi}\oint_{\mathbf q\in\mathcal C}\|\mathbf q-\mathbf p\|\,\mathrm d\theta.$ $

and $ \mathbf{p}$ is the points maximizing $ \overline{r}$ .

(Conveniently, this integral can also be computed for non-star-shaped curves; for a ray that meets the curve multiple times, it amounts to taking the total length of all segments that lie in the interior of the curve.)

In a previous answer, using Mesh Coordinates, Discretization, and Euler’s Distance, I could calculate the average radius of a closed smooth curve.

`curve = DiscretizeRegion[ ImplicitRegion[ S1[x, y] == 1, {{x, -3, 3}, {y, -4, 4}}], {{-3, 3}, {-4, 4}}, AccuracyGoal -> 8] q = MeshCoordinates[curve]; edges = First /@ MeshCells[curve, 1]; signedAngle[a_, b_] := Arg[(Complex @@ a)/(Complex @@ b)] avgRadius[p_] := 1/(2 \[Pi]) Abs[Sum[Module[{q1, q2, r, d\[Theta]}, q1 = q[[First@e]]; q2 = q[[Last@e]]; r = EuclideanDistance[p, (q1 + q2)/2];(*midpoint approximation*) d\[Theta] = signedAngle[q1 - p, q2 - p]; r d\[Theta]], {e, edges}]] s = FindMaximum[avgRadius[{x, y}], {{x, 0}, {y, 0}}] `

However, I wanted to apply a similar definition to closed shapes that contain straight lines.

**Shapes With Straight Lines: Polygons**

For example, with a triangle, if I apply `DescritizeRegion`

`curve = DiscretizeRegion[ Graphics[Line[{{-1, 0}, {0, 1}, {1, 0}, {-1, 0}}]], {{-1, 1}, {-1, 1}}, AccuracyGoal -> 8] `

but it gives the following.

`DiscretizeRegion::regp: A correctly specified region expected at position 1 of DiscretizeRegion[,{{-1,1},{-1,1}},AccuracyGoal->8].`

Unsure what the error meant I used `BoundaryMeshRegion`

`curve = DiscretizeRegion[ BoundaryMeshRegion[{{-1, 0}, {0, 1}, {1, 0}}, Line[{1, 2, 3, 1}]], {{-1, 1}, {0, 1}}, AccuracyGoal -> 8] `

Instead they discretize the area of the triangle.

How do I apply $ \overline{r}(x,y)$ to the triangle? Similarily how would apply this to a dumbell shaped curve?