I want to create a picture like this:
This picture was found in Regular Polygon Divisionby Diagonals.
But these codes are too old to run.
I think I can use Graphics`Mesh`FindIntersections to find all the intersection points.
lines=Line/@Tuples[CirclePoints[7],2];
pts=Graphics`Mesh`FindIntersections[lines]
Graphics[{{Thickness[0.005],lines},{Directive[Red,PointSize[0.02]],Point[pts]}}]
Looks it meets a bug. I need another way or try to fix it.
Answer
This is a brute-force solution that works in version 11.1, but not in the latest version:
lines = Line /@ Subsets[CirclePoints[7], {2}];
pts = DeleteCases[RegionIntersection @@@ Subsets[lines, {2}], _EmptyRegion];
Graphics[{lines, Directive[Red, PointSize[Large]], pts}]

In 11.2, the corner points are missed:

because RegionIntersection[] apparently lost the ability to find intersections of two line segments sharing an endpoint in 11.2:
RegionIntersection[Line[{{0, 0}, {1, 0}}], Line[{{0, 0}, {0, 1}}]]
EmptyRegion[2]
where 11.1 would give the result Point[{{0, 0}}].


Comments
Post a Comment