How do you instruct Mathematica to return intersection points between curves as numerical values, when using ParametricRegion
to represent at least one of the curves? For example, these are the regions for a line segment and a cubic Bezier curve:
cubicbez[a_, b_, c_, d_, t_] := (1 - t)^3*a + 3*(1 - t)^2*t*b + 3*(1 - t)*t^2*c + t^3*d
bezierRegion[{a_,b_,c_,d_}]:=ParametricRegion[cubicbez[a,b,c,d,t],{{t,0,1}}]
r1=Line[{{2,1},{4,7}}];
r2=bezierRegion[{{0,5},{9,6},{-2,4},{6,3}}];
ri=RegionIntersection[r1,r2];
Show[{Region[r1],Region[r2],Region[ri,BaseStyle->Red]},Frame->True]
As you can see, Mathematica has no trouble finding the intersection points.
I then ask Mathematica to return the coordinates of the intersection points as follows:
MeshCoordinates[DiscretizeRegion[ri]]
which returns
{{3.20154, 4.60463}, {3.42285, 5.26855}}
when using Mathematica 12.3.0.0. I.e., one of the intersections points (the lower left one) is missing.
What would be the proper way to get the intersection points?
(N.B. I know that you can compute the intersections of a cubic Bezier curve and a line in other ways, e.g. algebraically using Cardano's formula, or using numerical methods, but I'd like to know how to use Mathematica's regions for that purpose.)