2
$\begingroup$

Why am I getting some extra intersection points?enter image description here

 Manipulate[b = 2 r + 1;
 Show[p1 = 
   ContourPlot[{x^2 + (y - r)^2 == r^2, x/12 + y/b == 1}, {x, -20, 
     20}, {y, -20, 20}, Axes -> True, Frame -> False, 
    AspectRatio -> 1, PerformanceGoal -> "Goal"],
  Graphics[{PointSize[Large], Red, 
    Point@Graphics`Mesh`FindIntersections[p1]}]], {{r, 4, 
   "Radius"}, -10, 10, 0.01}]

Why is this not plotting the right

Obviously, this should not have intersection in the pic above.

$\endgroup$
1
3
$\begingroup$
Clear["Global`*"]

You can use Graphics`Mesh`FindIntersections[p1, Graphics`Mesh`AllPoints -> False] to eliminate extra points; however, it will also miss the tangent point. It is easy to just solve for the intersections.

Manipulate[
 Module[
  {sol, b, eqns},
  b = 2 r + 1;
  eqns = {x^2 + (y - r)^2 == r^2, x/12 + y/b == 1};
  sol = Solve[eqns, {x, y}, Reals] // Quiet;
  ContourPlot[Evaluate@eqns,
   {x, -20, 20}, {y, -20, 20},
   Axes -> True,
   Frame -> False,
   AspectRatio -> 1,
   PerformanceGoal -> "Goal",
   Epilog -> {PointSize[Large], Red,
     If[Length@sol > 0, Point[{x, y} /. sol], Nothing]}]],
 {{r, 4, "Radius"}, -10, 10, 0.01, Appearance -> "Labeled"}]

corrected plot with the tangent as the single intersection

$\endgroup$
3
  • $\begingroup$ Coordinate {{ConditionalExpression[$CellContextb^(-1) (12 $CellContextb - 12 (4 (144 + $CellContextb^2)^(-1) (36 $CellContextb + $CellContextb^2) - 8 2^Rational[1, 2] (-(144 + $CellContextb^2)^(-2) ((-9) $CellContextb^3 + $CellContextb^4))^Rational[1, 2])), should be a pair of numbers, or a Scaled or Offset form. $\endgroup$ – kile Mar 12 '20 at 10:18
  • $\begingroup$ The line is not moving with the slider $\endgroup$ – kile Mar 12 '20 at 10:19
  • $\begingroup$ @kile - restructured the Module. Try it now. $\endgroup$ – Bob Hanlon Mar 12 '20 at 12:57

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.