# Derive a polygon from the midpoints of the sides of a given polygon [closed]

Write a function that creates a new figure (a new broken line) out of a given broken line. It would take as parameter a list of (max) 20 points representing the closed broken line. The output must be a plot with the two figures in different colors.

The new figure is created by connecting midpoints of consecutive segments of the figure.

Suggestion. Keep the coordinates of the randomly generated points in a symmetrical interval, for simplicity.

Observation. A closed broken line is a figure made of segments such that each segment's left endpoint is connected to another segment's right endpoint.

Given four points, the output should be similar to this:

• What have you tried? This looks like a homework problem and we generally like to see what you've tried before we try to help. – b3m2a1 Mar 28 '19 at 18:19
• ListLinePlot might be of interest. – Henrik Schumacher Mar 28 '19 at 18:23
• @HighPerformanceMark before the edit it was – b3m2a1 Mar 28 '19 at 21:13
• This is not a do-my-homework site. – Daniel Lichtblau Mar 29 '19 at 15:43

I would typically not answer this kind of questions, but this was interesting to me:

BlockRandom[SeedRandom[5348]; pts = RandomReal[{-2, 2}, {4, 2}]];

Graphics[{
FaceForm[None],
EdgeForm[{Thick, Blue}], Polygon[pts],
EdgeForm[{Thick, Red}], Polygon[Mean /@ Partition[pts, 2, 1, {1, 1}]]
},
Axes -> True
]


• Usually, I use ListCorrelate[] instead of Mean[] + Partition[], but this works. – J. M.'s technical difficulties Mar 29 '19 at 1:13