5
$\begingroup$

I have two circles and tangential line segments that I want to define a region:

center1={0,0};
center2={8,0};
radius1 = 4;
radius2 = 3;
circle1=Circle[center1,radius1];
circle2=Circle[center2,radius2];
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]
Graphics[{circle1,circle2, Line[tangent]}]

enter image description here

How can I delete the inner arcs of the circles and create a region that is bounded by the outer lines and arcs of the shape?

I have Mathematica 10.1 so I can use the latest functions in Geometry.

$\endgroup$
8
$\begingroup$
ConvexHullMesh[
 Flatten[Table[{4 (a = {Cos[t], Sin[t]}), {8, 0} + 3 a}, 
   {t, 0, 2 π, 0.1}], 1]]

enter image description here

$\endgroup$
6
$\begingroup$

I would suggest using Disk instead of Circle as a start; the following generates a Region object that should generate what you are looking for:

center1 = {0, 0};
center2 = {8, 0};
radius1 = 4;
radius2 = 3;

circle1 = Disk[center1, radius1];
circle2 = Disk[center2, radius2];
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];

points = Flatten[tangent, 1];

RegionPlot[
 RegionUnion[
  circle1, circle2, 
  Polygon@points[[First@Rest@FindShortestTour@points]]
 ],
 AspectRatio -> Automatic
]

Mathematica graphics

$\endgroup$
  • $\begingroup$ MarcoB: How would you "know" where the intersection points are? $\endgroup$ – David G. Stork Aug 13 '15 at 0:19
  • $\begingroup$ @David Quite. I I misread the question. Thanks for pointing that out; I removed that part. $\endgroup$ – MarcoB Aug 13 '15 at 0:32
2
$\begingroup$

I have found a simple solution which is to compute the outer circular arcs and use the arcs instead of the circles:

angle1 = ArcTan[tangent[[1, 1, 2]]/tangent[[1, 1, 1]]];
angle2 = ArcTan[tangent[[2, 1, 2]]/tangent[[2, 1, 1]]];
arc1 = Circle[center1, radius1, { -1 angle1, 2 π + angle1}];
arc2 = Circle[center2, radius2, { -1 angle2, angle2}];
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.