5
$\begingroup$

I have the following code which finds intersection of two curves using mesh functions:

y[x_] := x^2
z[x_] := 1
P1 = Plot[y[x], {x, 0, 2}];
P2 = Plot[z[x], {x, 0, 2}];
Test = Show[P1, P2]
Graphics`Mesh`FindIntersections[Test // DiscretizeGraphics, 
 Graphics`Mesh`AllPoints -> False]

This works well in all versions of Mathematica including Mathematica 13.3. But if I modify the code a little bit like this:

y[x_] := x^2
z[x_] := 1
P1 = Plot[y[x], {x, 0, 2}];
P2 = Graphics[{InfiniteLine[{{0, 1}, {2, 1}}]}];
Test = Show[P1, P2]
Graphics`Mesh`FindIntersections[Test // DiscretizeGraphics, 
 Graphics`Mesh`AllPoints -> False]

It works well on all Mathematica versions except Mathematica 13.3. Is this a bug in the latest version?

$\endgroup$
3
  • 1
    $\begingroup$ It's not a bug if WRI wants to change the behavior of an undocumented function. You really should report it and see what they say. I don't know what Graphics`Mesh`AllPoints -> False is supposed to do, but the function does not return all point, right? $\endgroup$
    – Goofy
    Jan 4 at 7:25
  • 2
    $\begingroup$ Both code blocks evaluate in Mathematica v12.2! $\endgroup$ Jan 4 at 7:44
  • 3
    $\begingroup$ suppress PlotHighlighting (new in version 13.3) using P1 = Plot[y[x], {x, 0, 2}, PlotHighlighting -> None]? $\endgroup$
    – kglr
    Jan 4 at 7:47

1 Answer 1

6
$\begingroup$

This maybe works like before:

Block[{Annotation = # &},
 Graphics`Mesh`FindIntersections[Test // DiscretizeGraphics, 
  Graphics`Mesh`AllPoints -> False]
 ]

(* {{0.999811, 1.}} *)

Darned annotations.

My guess is that it's DiscretizeGraphics that behaves different, but prior behavior not given in OP.

$\endgroup$
2
  • $\begingroup$ Actually I use it on my Mathematica 13.3 because of this particular reason as mentioned in a previous question : mathematica.stackexchange.com/questions/289187/… $\endgroup$
    – codebpr
    Jan 4 at 12:46
  • 1
    $\begingroup$ @codebpr Works there, too. See new answer. $\endgroup$
    – Goofy
    Jan 4 at 15:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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