Create region from set of lines and arcs [duplicate]

This question already has an answer here:

Create region from polygons and tangential line segments

3 answers

I have a shape that is a knuckle plate with two holes cut in it, thus:

center1 = {0, 0};
center2 = {8, 0};
radius1 = 4;
radius2 = 3;
arc1 = Circle[center1, radius1, { -1 angle1, 2 \[Pi] + angle1}];
arc2 = Circle[center2, radius2, { -1 angle2, angle2}];
endpoint1 = {x1, y1};
endpoint2 = {x2, y2};
tangent = {endpoint1, endpoint2} /.
Solve[{(endpoint2 – center2).(endpoint2 – endpoint1) ==
0, (endpoint1 – center1).(endpoint2 – endpoint1) ==
0, (endpoint1 – center1).(endpoint1 – center1) ==
radius1^2, (endpoint2 – center2).(endpoint2 – center2) ==
radius2^2, (endpoint1 – center1).(endpoint2 – center2) >
0}, {x1, y1, x2, y2}, Reals];
angle1 = ArcTan[tangent[[1, 1, 2]]/tangent[[1, 1, 1]]];
angle2 = ArcTan[tangent[[2, 1, 2]]/tangent[[2, 1, 1]]];
bores = Circle[#, 1] & /@ {center1, center2};
Graphics[{arc1, arc2, Line[tangent], bores}]

I want to be able create a region which is defined by the perimeter of the knuckle plate subtracted by the holes. I started to do this and ran into problems:

plate = RegionUnion[arc1, arc2, Line[tangent]];
platemesh = BoundaryDiscretizeRegion[plate];
Graphics[{platemesh}]

This gives errors such as “There is not a boundary representation that uniquely defines a region with region dimension 1 embedded in dimension 2”. (Note that I am hoping for a general answer that would work for any set of connected lines and arcs, not just a convex shape.)

Note on potential duplicates:

Solutions that involve ConvexHull are not applicable as explained above

Solution from a related post:

Polygon@points[[First@Rest@FindShortestTour@points]]

Involves flattening of the line segments into discrete points, which for a complex set of paths could be complicated. Ideally, I am looking for a solution that computes the region using the paths as the primary inputs without having to break those paths into more primitive objects.

=================

=================

1 Answer
1

=================

I am using all your definitions, except for bores, which I modified to use Disk instead of Circle:

bores = Disk[#, 1] & /@ {center1, center2};

RegionDifference[
DiscretizeRegion@RegionUnion[
Disk[center1, radius1],
Disk[center2, radius2],
Polygon[tangent[[1]]~Join~Reverse[tangent[[2]]]]
],
DiscretizeRegion@RegionUnion[bores]
]

  

 

This solves the immediate problem, but does not answer the question of how to create a region from a set of connected arcs and line segments.
– Tyler Durden
Aug 13 ’15 at 16:17