I am really looking just for the least amount of code needed to do this but it is still readable.
Here is the same polygon but the border is respectively split up into 10, 20, and 30 points along the perimeter:
The code I used to produce this is:
OrderVerticesClockwise[pts_List] := Module[
{pivot, sorted, remainingPoints},
(* Find the pivot: the lowest and leftmost point *)
pivot = First[SortBy[pts, {Last, First}]];
(* Remove the pivot from the list *)
remainingPoints = DeleteCases[pts, pivot];
(* Sort the remaining vertices based on the polar angle relative to the pivot *)
sorted = SortBy[remainingPoints, ArcTan[#[[1]] - pivot[[1]], #[[2]] - pivot[[2]]] &];
(* Return ordered vertices with the pivot at the beginning *)
Prepend[sorted, pivot]
]
Clear[EquidistantPoints];
EquidistantPoints[pts_List, n_Integer] := Module[
{
closedPts = Append[pts, First[pts]],
lengths, totalLength, interval, accumulatedLengths, currentPt, nextPt,
distRemaining, currentIndex, result = {}
},
lengths = EuclideanDistance @@@ Partition[closedPts, 2, 1];
totalLength = Total[lengths];
interval = totalLength/n;
accumulatedLengths = Accumulate[lengths];
Do[
distRemaining = i*interval;
currentIndex = 1;
While[distRemaining > accumulatedLengths[[currentIndex]],
currentIndex++;
];
distRemaining -= If[currentIndex > 1, accumulatedLengths[[currentIndex - 1]], 0];
currentPt = closedPts[[currentIndex]];
nextPt = closedPts[[currentIndex + 1]];
AppendTo[result, currentPt + (distRemaining/lengths[[currentIndex]]) * (nextPt - currentPt)];
, {i, 0, n - 1}
];
result
]
equiArcLengthPointQuantity=20;
poly = RandomPolygon[12];
vertices = PolygonCoordinates[poly];
orderedVertices = OrderVerticesClockwise[vertices];
equiArcDistances = Accumulate[Table[Perimeter[poly]/equiArcLengthPointQuantity, {i, 1, equiArcLengthPointQuantity}]];
equidistantPts = EquidistantPoints[orderedVertices, equiArcLengthPointQuantity];
Graphics[
{Polygon[orderedVertices], Red, PointSize[0.02], Point[equidistantPts]}
]
I would assume that there is a much simpler way of doing this, but I couldn't think of one. And I don't know what else to call these points. They aren't equally distanced points in Euclidean space, just along the perimeter by arc length.











MeshFunctions -> {0 &, "ArcLength"– Daniel Huber Aug 29 '23 at 09:250&come from https://mathematica.stackexchange.com/a/277682/72111 The MeshFunctions of"ArcLength"is well know in this forum. – cvgmt Aug 29 '23 at 11:17Plot[Sin[x ], {x, 0, 10}, MeshFunctions -> {0 &, ArcLength}, Mesh -> {10}, MeshStyle -> {PointSize[0.03]}]Do you know where to find info anout this? – Daniel Huber Aug 29 '23 at 11:44Mesh -> {10}will ignore the boundary points. So we need to useMesh->{Subdivide@10}etc. – cvgmt Aug 29 '23 at 11:46Plot[Sin[x], {x, 0, π*3}, MeshFunctions -> {0 &, "ArcLength"}, Mesh -> {{0, 0.5, 1}}, MeshStyle -> {PointSize[0.03]}]orPlot[Sin[x], {x, 0, π*3}, MeshFunctions -> {0 &, "ArcLength"}, Mesh -> {Subdivide[0, 1, 6]}, MeshStyle -> {PointSize[0.03]}]– cvgmt Aug 29 '23 at 12:01