2
$\begingroup$

I have radius to draw circle using formulation below:

rhom = 0.262707;
circle = Table[{rhom*Cos[Theta*Degree], rhom*Sin[Theta*Degree]}, {Theta, 1, 360}] // N;

I also have 2 lists of data points:

A={{-0.104703,0.264857},{-0.236896,0.0575121},{-0.387596,-0.136798},{-0.555529,-0.316423},{-0.739274,-0.479839},{-0.937274,-0.625657},{-1.14785,-0.752641}};
B={{1.27548,0.237216},{0.406627,-0.105033},{-0.456116,-0.462393},{-1.31249,-0.834755}};

How to find the intersection point as shown in the figure below?

enter image description here

$\endgroup$

2 Answers 2

1
$\begingroup$
a = Interpolation[A];
b = Interpolation[B];
ptA = {t, a[t]} /. FindRoot[a[t]^2 + t^2 - rhom^2, {t, -.2}];
ptB = {t, b[t]} /. FindRoot[b[t]^2 + t^2 - rhom^2, {t, 0}];
{ptA, ptB}

(* {{-0.261721, 0.0227437}, {0.0231856, -0.261682}} *)

Show[Plot[a[t], {t, -1, -0.1}], Plot[b[t], {t, -1, 1}], 
 Graphics[{Circle[{0, 0}, rhom], PointSize[0.02], Red, 
   Point[{ptA, ptB}]}], PlotRange -> All]

enter image description here

$\endgroup$
1
$\begingroup$

You can solve it in different ways. There is the more basic math way using those conventional FindRoot, NSolve etc. I show here a method using a comparatively newer function in the family named MeshRegion.

  1. Generate a MeshRegion from the points giving you circle, and the lines a and b as 2D geometric boundaries.
  2. Then we take respective intersection between those objects, giving us 2D points that we are seeking.

So code is:

circle = MeshRegion[circle, Line[Range[Length@circle]~Join~{1}]];
{a, b} = MeshRegion[#, Line[Range@Length@#]] & /@ {A, B};
{ptA, ptB} = MeshCoordinates@RegionIntersection[##] & @@@ {{circle , a}, {circle , b}}

{{{-0.261419,0.0258928},{-0.12692,0.230009}},{{0.030195,-0.260956},{0.163173,-0.205875}}}

You can see the found points graphically.

Show[circle , a, b, Graphics@{Orange, [email protected], Point /@ ptA}, 
 Graphics@{Green, [email protected], Point /@ ptB}, Axes -> True]

enter image description here

Also note that the more number of points you have to discretely represent your geometric objects, the more accurate this solution will be.

$\endgroup$
2
  • $\begingroup$ I try use it on Version 10.3 but it does not work as your illustration above. I have error on code {ptA,ptB}=MeshCoordinates@RegionIntersection[##] & @@@ {{circle , a}, {circle , b}}. Please give me advice, @PlatoManiac $\endgroup$
    – SelfA
    Commented Feb 19, 2018 at 3:59
  • $\begingroup$ The function MeshRegion is available from version 11, it will not work in 10.3. The other answer will work on 10.3. $\endgroup$ Commented Feb 19, 2018 at 10:21

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.